Skip to content

Commit 4da42c3

Browse files
committed
Build emutls.c on Android.
Android uses emulated TLS so we need a runtime support function from this source file.
1 parent 0ce02f3 commit 4da42c3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ mod c {
489489
sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]);
490490
}
491491

492+
// Android uses emulated TLS so we need a runtime support function.
493+
if target_os == "android" {
494+
sources.extend(&[("__emutls_get_address", "emutls.c")]);
495+
496+
// Work around a bug in the NDK headers (fixed in
497+
// https://r.android.com/2038949 which will be released in a future
498+
// NDK version) by providing a definition of LONG_BIT.
499+
cfg.define("LONG_BIT", "(8 * sizeof(long))");
500+
}
501+
492502
// When compiling the C code we require the user to tell us where the
493503
// source code is, and this is largely done so when we're compiling as
494504
// part of rust-lang/rust we can use the same llvm-project repository as

0 commit comments

Comments
 (0)