diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-08-07 01:08:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-07 01:08:44 -0700 |
| commit | b071b10ce83609199577ff077fb117ed62c98fe7 (patch) | |
| tree | e7ab9b6278e96a518e9a668783715d7d23b204b5 /src | |
| parent | 8268d7be52fdcff9dde3020f65aeb48b76f4397e (diff) | |
| parent | 7d88bd0b9c4ca12235769a04c45842dab3b54827 (diff) | |
| download | zig-b071b10ce83609199577ff077fb117ed62c98fe7.tar.gz zig-b071b10ce83609199577ff077fb117ed62c98fe7.zip | |
Merge pull request #20894 from alexrp/target-cleanup-4
`std.Target`: Minor rework to some `isArch()` functions, fix some related issues throughout `std`
Diffstat (limited to 'src')
| -rw-r--r-- | src/codegen/llvm.zig | 4 | ||||
| -rw-r--r-- | src/glibc.zig | 18 | ||||
| -rw-r--r-- | src/libunwind.zig | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 23e39caa98..1ba1ed8b6f 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -399,7 +399,7 @@ const DataLayoutBuilder = struct { else if (self.target.cpu.arch == .powerpc64 and self.target.os.tag != .freebsd and self.target.abi != .musl) try writer.writeAll("-Fi64") - else if (self.target.cpu.arch.isPPC() or self.target.cpu.arch.isPPC64()) + else if (self.target.cpu.arch.isPowerPC()) try writer.writeAll("-Fn32"); if (self.target.cpu.arch != .hexagon) { if (self.target.cpu.arch == .arc or self.target.cpu.arch == .s390x) @@ -659,7 +659,7 @@ const DataLayoutBuilder = struct { 128 => abi = 64, else => {}, } - } else if ((self.target.cpu.arch.isPPC64() and self.target.os.tag == .linux and + } else if ((self.target.cpu.arch.isPowerPC64() and self.target.os.tag == .linux and (size == 256 or size == 512)) or (self.target.cpu.arch.isNvptx() and (size == 16 or size == 32))) { diff --git a/src/glibc.zig b/src/glibc.zig index 5214d0a977..b218b98fd8 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -392,9 +392,9 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progre fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![]const u8 { const arch = comp.getTarget().cpu.arch; - const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le; - const is_aarch64 = arch == .aarch64 or arch == .aarch64_be; - const is_sparc = arch == .sparc or arch == .sparc64; + const is_ppc = arch.isPowerPC(); + const is_aarch64 = arch.isAARCH64(); + const is_sparc = arch.isSPARC(); const is_64 = comp.getTarget().ptrBitWidth() == 64; const s = path.sep_str; @@ -412,7 +412,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ try result.appendSlice("sparc" ++ s ++ "sparc32"); } } - } else if (arch.isARM()) { + } else if (arch.isArmOrThumb()) { try result.appendSlice("arm"); } else if (arch.isMIPS()) { if (!mem.eql(u8, basename, "crti.S") and !mem.eql(u8, basename, "crtn.S")) { @@ -529,10 +529,10 @@ fn add_include_dirs_arch( dir: []const u8, ) error{OutOfMemory}!void { const arch = target.cpu.arch; - const is_x86 = arch == .x86 or arch == .x86_64; - const is_aarch64 = arch == .aarch64 or arch == .aarch64_be; - const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le; - const is_sparc = arch == .sparc or arch == .sparc64; + const is_x86 = arch.isX86(); + const is_aarch64 = arch.isAARCH64(); + const is_ppc = arch.isPowerPC(); + const is_sparc = arch.isSPARC(); const is_64 = target.ptrBitWidth() == 64; const s = path.sep_str; @@ -562,7 +562,7 @@ fn add_include_dirs_arch( try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86" })); } - } else if (arch.isARM()) { + } else if (arch.isArmOrThumb()) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "arm", nptl })); diff --git a/src/libunwind.zig b/src/libunwind.zig index 7783876827..dd2ed39130 100644 --- a/src/libunwind.zig +++ b/src/libunwind.zig @@ -131,7 +131,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr if (!comp.config.any_non_single_threaded) { try cflags.append("-D_LIBUNWIND_HAS_NO_THREADS"); } - if (target.cpu.arch.isARM() and target.abi.floatAbi() == .hard) { + if (target.cpu.arch.isArmOrThumb() and target.abi.floatAbi() == .hard) { try cflags.append("-DCOMPILER_RT_ARMHF_TARGET"); } try cflags.append("-Wno-bitwise-conditional-parentheses"); |
