| author | |
| committer | |
| log | e62352611faf3056b989cc1edaa4aedaa74f326e |
| tree | 0de1037e6567e6ee17df85eb9936987a7642459b |
| parent | ce8c61b0fcb7e0610d4b39728b2d73ed10e762f6 |
| signature |
These deal with how Zig stores OS headers in `lib/libc/include` and so don't
really belong in std.Target.4 files changed, 19 insertions(+), 23 deletions(-)
lib/std/Target.zig-21| ... | ... | @@ -218,23 +218,6 @@ pub const Os = struct { |
| 218 | 218 | .windows => .windows, |
| 219 | 219 | }; |
| 220 | 220 | } |
| 221 | ||
| 222 | pub fn archName(tag: Tag, arch: Cpu.Arch) [:0]const u8 { | |
| 223 | return switch (tag) { | |
| 224 | .linux => switch (arch) { | |
| 225 | .arm, .armeb, .thumb, .thumbeb => "arm", | |
| 226 | .aarch64, .aarch64_be => "aarch64", | |
| 227 | .loongarch32, .loongarch64 => "loongarch", | |
| 228 | .mips, .mipsel, .mips64, .mips64el => "mips", | |
| 229 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc", | |
| 230 | .riscv32, .riscv64 => "riscv", | |
| 231 | .sparc, .sparc64 => "sparc", | |
| 232 | .x86, .x86_64 => "x86", | |
| 233 | else => @tagName(arch), | |
| 234 | }, | |
| 235 | else => @tagName(arch), | |
| 236 | }; | |
| 237 | } | |
| 238 | 221 | }; |
| 239 | 222 | |
| 240 | 223 | /// Based on NTDDI version constants from |
| ... | ... | @@ -3357,10 +3340,6 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { |
| 3357 | 3340 | }; |
| 3358 | 3341 | } |
| 3359 | 3342 | |
| 3360 | pub fn osArchName(target: std.Target) [:0]const u8 { | |
| 3361 | return target.os.tag.archName(target.cpu.arch); | |
| 3362 | } | |
| 3363 | ||
| 3364 | 3343 | const Target = @This(); |
| 3365 | 3344 | const std = @import("std.zig"); |
| 3366 | 3345 | const builtin = @import("builtin"); |
lib/std/zig/LibCDirs.zig+1-1| ... | ... | @@ -187,7 +187,7 @@ pub fn detectFromBuilding( |
| 187 | 187 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "generic-{s}", |
| 188 | 188 | .{ zig_lib_dir, generic_name }, |
| 189 | 189 | ); |
| 190 | const generic_arch_name = target.osArchName(); | |
| 190 | const generic_arch_name = std.zig.target.osArchName(target); | |
| 191 | 191 | const arch_os_include_dir = try std.fmt.allocPrint( |
| 192 | 192 | arena, |
| 193 | 193 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{s}-{s}-any", |
lib/std/zig/target.zig+17| ... | ... | @@ -129,6 +129,23 @@ pub fn glibcRuntimeTriple( |
| 129 | 129 | }; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | pub fn osArchName(target: std.Target) [:0]const u8 { | |
| 133 | return switch (target.os.tag) { | |
| 134 | .linux => switch (target.cpu.arch) { | |
| 135 | .arm, .armeb, .thumb, .thumbeb => "arm", | |
| 136 | .aarch64, .aarch64_be => "aarch64", | |
| 137 | .loongarch32, .loongarch64 => "loongarch", | |
| 138 | .mips, .mipsel, .mips64, .mips64el => "mips", | |
| 139 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc", | |
| 140 | .riscv32, .riscv64 => "riscv", | |
| 141 | .sparc, .sparc64 => "sparc", | |
| 142 | .x86, .x86_64 => "x86", | |
| 143 | else => @tagName(target.cpu.arch), | |
| 144 | }, | |
| 145 | else => @tagName(target.cpu.arch), | |
| 146 | }; | |
| 147 | } | |
| 148 | ||
| 132 | 149 | pub fn muslArchName(arch: std.Target.Cpu.Arch, abi: std.Target.Abi) [:0]const u8 { |
| 133 | 150 | return switch (abi) { |
| 134 | 151 | .muslabin32 => "mipsn32", |
src/glibc.zig+1-1| ... | ... | @@ -469,7 +469,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([ |
| 469 | 469 | try args.append("-I"); |
| 470 | 470 | try args.append(try lib_path(comp, arena, lib_libc ++ "include" ++ s ++ "generic-glibc")); |
| 471 | 471 | |
| 472 | const arch_name = target.osArchName(); | |
| 472 | const arch_name = std.zig.target.osArchName(target); | |
| 473 | 473 | try args.append("-I"); |
| 474 | 474 | try args.append(try std.fmt.allocPrint(arena, "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{s}-linux-any", .{ |
| 475 | 475 | comp.zig_lib_directory.path.?, arch_name, |