aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-11-29 16:51:05 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-11-29 18:05:11 -0700
commit19eaf54bc9ea8229dd0ae9e8e99865aba6fe4398 (patch)
tree4c880f4cef886512213513b170024e51c145e866 /src/target.zig
parentec10e63f4945e81cfc5369a2c886ef0b7ae11c1b (diff)
downloadzig-19eaf54bc9ea8229dd0ae9e8e99865aba6fe4398.tar.gz
zig-19eaf54bc9ea8229dd0ae9e8e99865aba6fe4398.zip
update libc linux headers to v5.16-rc3
* Add missing Linux headers. Closes #9837 * Update existing headers to latest Linux. * Consolidate headers that are the same for multiple Zig target CPU architectures. For example, Linux has only an x86 directory for both x86_64 and x86 CPU architectures. Now Zig only ships an x86 directory for Linux headers, and will emit the proper corresponding -isystem flags. * tools/update-linux-headers.zig is now available for upgrading to newer Linux headers, and the update process is now documented on the wiki.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index 6f6d9f811d..9d22feff66 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -106,6 +106,22 @@ pub fn libCGenericName(target: std.Target) [:0]const u8 {
}
}
+pub fn osArchName(target: std.Target) [:0]const u8 {
+ return switch (target.os.tag) {
+ .linux => switch (target.cpu.arch) {
+ .arm, .armeb, .thumb, .thumbeb => "arm",
+ .aarch64, .aarch64_be, .aarch64_32 => "arm64",
+ .mips, .mipsel, .mips64, .mips64el => "mips",
+ .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc",
+ .riscv32, .riscv64 => "riscv",
+ .sparc, .sparcel, .sparcv9 => "sparc",
+ .i386, .x86_64 => "x86",
+ else => @tagName(target.cpu.arch),
+ },
+ else => @tagName(target.cpu.arch),
+ };
+}
+
pub fn canBuildLibC(target: std.Target) bool {
for (available_libcs) |libc| {
if (target.cpu.arch == libc.arch and target.os.tag == libc.os and target.abi == libc.abi) {