| author | |
| committer | |
| log | e0ac776749f2d5ac3ffd5717ce5208f859d12028 |
| tree | 64656c6dde72c85b28a142b5ec718da31ebd73d0 |
| parent | 26d35cc1128c12fe11331915511524550e88bc15 |
| parent | ebbc50d8be3582cb67baa952ce7a52296a04a3c1 |
| signature |
`std.Target`: Introduce `Abi.androideabi` to distinguish the soft float case.10 files changed, 34 insertions(+), 22 deletions(-)
lib/compiler/aro/aro/Compilation.zig+1-1| ... | ... | @@ -308,7 +308,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void { |
| 308 | 308 | ), |
| 309 | 309 | else => {}, |
| 310 | 310 | } |
| 311 | if (comp.target.abi == .android) { | |
| 311 | if (comp.target.isAndroid()) { | |
| 312 | 312 | try w.writeAll("#define __ANDROID__ 1\n"); |
| 313 | 313 | } |
| 314 | 314 |
lib/compiler/aro/aro/target.zig+1| ... | ... | @@ -690,6 +690,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { |
| 690 | 690 | .eabi => "eabi", |
| 691 | 691 | .eabihf => "eabihf", |
| 692 | 692 | .android => "android", |
| 693 | .androideabi => "androideabi", | |
| 693 | 694 | .musl => "musl", |
| 694 | 695 | .musleabi => "musleabi", |
| 695 | 696 | .musleabihf => "musleabihf", |
lib/compiler_rt/common.zig+1| ... | ... | @@ -22,6 +22,7 @@ pub const want_aeabi = switch (builtin.abi) { |
| 22 | 22 | .gnueabi, |
| 23 | 23 | .gnueabihf, |
| 24 | 24 | .android, |
| 25 | .androideabi, | |
| 25 | 26 | => switch (builtin.cpu.arch) { |
| 26 | 27 | .arm, .armeb, .thumb, .thumbeb => true, |
| 27 | 28 | else => false, |
lib/compiler_rt/emutls.zig+1-1| ... | ... | @@ -18,7 +18,7 @@ const gcc_word = usize; |
| 18 | 18 | pub const panic = common.panic; |
| 19 | 19 | |
| 20 | 20 | comptime { |
| 21 | if (builtin.link_libc and (builtin.abi == .android or builtin.os.tag == .openbsd)) { | |
| 21 | if (builtin.link_libc and (builtin.abi.isAndroid() or builtin.os.tag == .openbsd)) { | |
| 22 | 22 | @export(&__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility }); |
| 23 | 23 | } |
| 24 | 24 | } |
lib/std/Target.zig+13-2| ... | ... | @@ -664,6 +664,7 @@ pub const Abi = enum { |
| 664 | 664 | eabihf, |
| 665 | 665 | ilp32, |
| 666 | 666 | android, |
| 667 | androideabi, | |
| 667 | 668 | musl, |
| 668 | 669 | musleabi, |
| 669 | 670 | musleabihf, |
| ... | ... | @@ -770,8 +771,16 @@ pub const Abi = enum { |
| 770 | 771 | }; |
| 771 | 772 | } |
| 772 | 773 | |
| 774 | pub inline fn isAndroid(abi: Abi) bool { | |
| 775 | return switch (abi) { | |
| 776 | .android, .androideabi => true, | |
| 777 | else => false, | |
| 778 | }; | |
| 779 | } | |
| 780 | ||
| 773 | 781 | pub inline fn floatAbi(abi: Abi) FloatAbi { |
| 774 | 782 | return switch (abi) { |
| 783 | .androideabi, | |
| 775 | 784 | .eabi, |
| 776 | 785 | .gnueabi, |
| 777 | 786 | .musleabi, |
| ... | ... | @@ -1617,7 +1626,7 @@ pub inline fn isMusl(target: Target) bool { |
| 1617 | 1626 | } |
| 1618 | 1627 | |
| 1619 | 1628 | pub inline fn isAndroid(target: Target) bool { |
| 1620 | return target.abi == .android; | |
| 1629 | return target.abi.isAndroid(); | |
| 1621 | 1630 | } |
| 1622 | 1631 | |
| 1623 | 1632 | pub inline fn isWasm(target: Target) bool { |
| ... | ... | @@ -1724,7 +1733,7 @@ pub const DynamicLinker = struct { |
| 1724 | 1733 | } |
| 1725 | 1734 | |
| 1726 | 1735 | pub fn standard(cpu: Cpu, os_tag: Os.Tag, abi: Abi) DynamicLinker { |
| 1727 | return if (abi == .android) initFmt("/system/bin/linker{s}", .{ | |
| 1736 | return if (abi.isAndroid()) initFmt("/system/bin/linker{s}", .{ | |
| 1728 | 1737 | if (ptrBitWidth_cpu_abi(cpu, abi) == 64) "64" else "", |
| 1729 | 1738 | }) catch unreachable else if (abi.isMusl()) return initFmt("/lib/ld-musl-{s}{s}.so.1", .{ |
| 1730 | 1739 | @tagName(switch (cpu.arch) { |
| ... | ... | @@ -2391,6 +2400,7 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { |
| 2391 | 2400 | .eabi, |
| 2392 | 2401 | .eabihf, |
| 2393 | 2402 | .android, |
| 2403 | .androideabi, | |
| 2394 | 2404 | .musleabi, |
| 2395 | 2405 | .musleabihf, |
| 2396 | 2406 | => 8, |
| ... | ... | @@ -2463,6 +2473,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { |
| 2463 | 2473 | .eabi, |
| 2464 | 2474 | .eabihf, |
| 2465 | 2475 | .android, |
| 2476 | .androideabi, | |
| 2466 | 2477 | .musleabi, |
| 2467 | 2478 | .musleabihf, |
| 2468 | 2479 | => {}, |
lib/std/Target/Query.zig+1-1| ... | ... | @@ -374,7 +374,7 @@ pub fn canDetectLibC(self: Query) bool { |
| 374 | 374 | if (self.isNativeOs()) return true; |
| 375 | 375 | if (self.os_tag) |os| { |
| 376 | 376 | if (builtin.os.tag == .macos and os.isDarwin()) return true; |
| 377 | if (os == .linux and self.abi == .android) return true; | |
| 377 | if (os == .linux and self.abi.isAndroid()) return true; | |
| 378 | 378 | } |
| 379 | 379 | return false; |
| 380 | 380 | } |
lib/std/c.zig+3-3| ... | ... | @@ -5946,7 +5946,7 @@ pub const PR = switch (native_os) { |
| 5946 | 5946 | }; |
| 5947 | 5947 | pub const _errno = switch (native_os) { |
| 5948 | 5948 | .linux => switch (native_abi) { |
| 5949 | .android => private.__errno, | |
| 5949 | .android, .androideabi => private.__errno, | |
| 5950 | 5950 | else => private.__errno_location, |
| 5951 | 5951 | }, |
| 5952 | 5952 | .emscripten => private.__errno_location, |
| ... | ... | @@ -6754,7 +6754,7 @@ pub const pthread_mutex_t = switch (native_os) { |
| 6754 | 6754 | .mips64, .powerpc64, .powerpc64le, .sparc64 => 40, |
| 6755 | 6755 | else => if (@sizeOf(usize) == 8) 40 else 24, |
| 6756 | 6756 | }, |
| 6757 | .android => if (@sizeOf(usize) == 8) 40 else 4, | |
| 6757 | .android, .androideabi => if (@sizeOf(usize) == 8) 40 else 4, | |
| 6758 | 6758 | else => @compileError("unsupported ABI"), |
| 6759 | 6759 | }; |
| 6760 | 6760 | }, |
| ... | ... | @@ -6848,7 +6848,7 @@ pub const pthread_cond_t = switch (native_os) { |
| 6848 | 6848 | |
| 6849 | 6849 | pub const pthread_rwlock_t = switch (native_os) { |
| 6850 | 6850 | .linux => switch (native_abi) { |
| 6851 | .android => switch (@sizeOf(usize)) { | |
| 6851 | .android, .androideabi => switch (@sizeOf(usize)) { | |
| 6852 | 6852 | 4 => extern struct { |
| 6853 | 6853 | data: [40]u8 align(@alignOf(usize)) = [_]u8{0} ** 40, |
| 6854 | 6854 | }, |
lib/std/zig/LibCDirs.zig+1| ... | ... | @@ -248,6 +248,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 { |
| 248 | 248 | .eabihf, |
| 249 | 249 | .ilp32, |
| 250 | 250 | .android, |
| 251 | .androideabi, | |
| 251 | 252 | .msvc, |
| 252 | 253 | .itanium, |
| 253 | 254 | .cygnus, |
src/codegen/llvm.zig+1| ... | ... | @@ -172,6 +172,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 172 | 172 | .eabi => "eabi", |
| 173 | 173 | .eabihf => "eabihf", |
| 174 | 174 | .android => "android", |
| 175 | .androideabi => "androideabi", | |
| 175 | 176 | .musl => "musl", |
| 176 | 177 | .musleabi => "musleabi", |
| 177 | 178 | .musleabihf => "musleabihf", |
src/target.zig+11-14| ... | ... | @@ -304,20 +304,17 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { |
| 304 | 304 | "-lc", |
| 305 | 305 | "-lnetwork", |
| 306 | 306 | }, |
| 307 | else => switch (target.abi) { | |
| 308 | .android => &[_][]const u8{ | |
| 309 | "-lm", | |
| 310 | "-lc", | |
| 311 | "-ldl", | |
| 312 | }, | |
| 313 | else => &[_][]const u8{ | |
| 314 | "-lm", | |
| 315 | "-lpthread", | |
| 316 | "-lc", | |
| 317 | "-ldl", | |
| 318 | "-lrt", | |
| 319 | "-lutil", | |
| 320 | }, | |
| 307 | else => if (target.isAndroid()) &[_][]const u8{ | |
| 308 | "-lm", | |
| 309 | "-lc", | |
| 310 | "-ldl", | |
| 311 | } else &[_][]const u8{ | |
| 312 | "-lm", | |
| 313 | "-lpthread", | |
| 314 | "-lc", | |
| 315 | "-ldl", | |
| 316 | "-lrt", | |
| 317 | "-lutil", | |
| 321 | 318 | }, |
| 322 | 319 | }; |
| 323 | 320 | } |