Skip to content

Commit

Permalink
sys: disable jit on apple >~= aarch64
Browse files Browse the repository at this point in the history
clang fails with

    Undefined symbols for architecture arm64:
      "___clear_cache", referenced from:
          _sljit_generate_code in libforeign.a(pcre2_jit_compile.o)
    ld: symbol(s) not found for architecture arm64
  • Loading branch information
b8591340 committed Aug 26, 2020
1 parent 94bd98a commit 81c1ead
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion pcre2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ fn main() {
.define("PARENS_NEST_LIMIT", "250")
.define("PCRE2_STATIC", "1")
.define("STDC_HEADERS", "1")
.define("SUPPORT_JIT", "1")
.define("SUPPORT_PCRE2_8", "1")
.define("SUPPORT_UNICODE", "1");
if target.contains("windows") {
builder.define("HAVE_WINDOWS_H", "1");
}

enable_jit(&target, &mut builder);

// Copy PCRE2 headers. Typically, `./configure` would do this for us
// automatically, but since we're compiling by hand, we do it ourselves.
let include = out.join("include");
Expand Down Expand Up @@ -151,3 +152,29 @@ fn pcre2_sys_static() -> Option<bool> {
}
}
}

// On `aarch64-apple-ios` clang fails with the following error.
//
// Undefined symbols for architecture arm64:
// "___clear_cache", referenced from:
// _sljit_generate_code in libforeign.a(pcre2_jit_compile.o)
// ld: symbol(s) not found for architecture arm64
//
// aarch64-apple-tvos https://bugreports.qt.io/browse/QTBUG-62993?gerritReviewStatus=All
// aarch64-apple-darwin https://github.com/Homebrew/homebrew-core/pull/57419
// x86_64-apple-ios disabled for device–simulator consistency (not tested)
// x86_64-apple-tvos disabled for device–simulator consistency (not tested)
// armv7-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
// armv7s-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
// i386-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
// x86_64-apple-ios-macabi disabled out of caution (not tested) (needs attention)
//
// We may want to monitor developments on the `aarch64-apple-darwin` front as they may end up
// propagating to all `aarch64`-based targets and the `x86_64` equivalents.
fn enable_jit(target: &str, builder: &mut cc::Build) {
if !target.starts_with("aarch64-apple") &&
!target.contains("apple-ios") &&
!target.contains("apple-tvos") {
builder.define("SUPPORT_JIT", "1");
}
}

0 comments on commit 81c1ead

Please sign in to comment.