Commit 8d4778b4f9

Louis Pearson <opensource@louispearson.work>
2022-10-22 00:32:56
Support compiling for the android NDK (#13245)
1 parent 3b2f0c3
Changed files (3)
lib
lib/compiler_rt/common.zig
@@ -9,6 +9,7 @@ pub const want_aeabi = switch (builtin.abi) {
     .musleabihf,
     .gnueabi,
     .gnueabihf,
+    .android,
     => switch (builtin.cpu.arch) {
         .arm, .armeb, .thumb, .thumbeb => true,
         else => false,
lib/compiler_rt/emutls.zig
@@ -18,7 +18,7 @@ const gcc_word = usize;
 pub const panic = common.panic;
 
 comptime {
-    if (builtin.link_libc and builtin.os.tag == .openbsd) {
+    if (builtin.link_libc and (builtin.abi == .android or builtin.os.tag == .openbsd)) {
         @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage });
     }
 }
lib/std/c/linux.zig
@@ -320,6 +320,9 @@ pub const pthread_rwlock_t = switch (native_abi) {
         size: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56,
     },
 };
+pub usingnamespace if (native_abi == .android) struct {
+    pub const pthread_key_t = c_int;
+} else struct {};
 pub const sem_t = extern struct {
     __size: [__SIZEOF_SEM_T]u8 align(@alignOf(usize)),
 };