Skip to content

Commit 710307d

Browse files
authored
sys: disable jit on apple >~= aarch64
This disables the JIT on a few targets because it doesn't appear to build. For example, 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 PR #16
1 parent 94bd98a commit 710307d

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

pcre2-sys/build.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ fn main() {
9393
.define("PARENS_NEST_LIMIT", "250")
9494
.define("PCRE2_STATIC", "1")
9595
.define("STDC_HEADERS", "1")
96-
.define("SUPPORT_JIT", "1")
9796
.define("SUPPORT_PCRE2_8", "1")
9897
.define("SUPPORT_UNICODE", "1");
9998
if target.contains("windows") {
10099
builder.define("HAVE_WINDOWS_H", "1");
101100
}
102101

102+
enable_jit(&target, &mut builder);
103+
103104
// Copy PCRE2 headers. Typically, `./configure` would do this for us
104105
// automatically, but since we're compiling by hand, we do it ourselves.
105106
let include = out.join("include");
@@ -151,3 +152,29 @@ fn pcre2_sys_static() -> Option<bool> {
151152
}
152153
}
153154
}
155+
156+
// On `aarch64-apple-ios` clang fails with the following error.
157+
//
158+
// Undefined symbols for architecture arm64:
159+
// "___clear_cache", referenced from:
160+
// _sljit_generate_code in libforeign.a(pcre2_jit_compile.o)
161+
// ld: symbol(s) not found for architecture arm64
162+
//
163+
// aarch64-apple-tvos https://bugreports.qt.io/browse/QTBUG-62993?gerritReviewStatus=All
164+
// aarch64-apple-darwin https://github.com/Homebrew/homebrew-core/pull/57419
165+
// x86_64-apple-ios disabled for device–simulator consistency (not tested)
166+
// x86_64-apple-tvos disabled for device–simulator consistency (not tested)
167+
// armv7-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
168+
// armv7s-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
169+
// i386-apple-ios assumed equivalent to aarch64-apple-ios (not tested)
170+
// x86_64-apple-ios-macabi disabled out of caution (not tested) (needs attention)
171+
//
172+
// We may want to monitor developments on the `aarch64-apple-darwin` front as they may end up
173+
// propagating to all `aarch64`-based targets and the `x86_64` equivalents.
174+
fn enable_jit(target: &str, builder: &mut cc::Build) {
175+
if !target.starts_with("aarch64-apple") &&
176+
!target.contains("apple-ios") &&
177+
!target.contains("apple-tvos") {
178+
builder.define("SUPPORT_JIT", "1");
179+
}
180+
}

0 commit comments

Comments
 (0)