authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2022-08-25 16:46:32+03:00
committergravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2022-08-25 16:46:32+03:00
log29e90efbb131b21eb7f41425a4dd4b74e6989942
treebcf3115e9a3a2ce30972115b949e3dc1bd63a5f6
parentea785f70ef5148f372c897e503e71c080b69e8da

src/glibc: remove redundant Arch

abilists now use Zig's arch, no need for a separate one.

1 files changed, 2 insertions(+), 49 deletions(-)

src/glibc.zig+2-49
...@@ -44,29 +44,6 @@ pub const libs = [_]Lib{...@@ -44,29 +44,6 @@ pub const libs = [_]Lib{
44 .{ .name = "resolv", .sover = 2 },44 .{ .name = "resolv", .sover = 2 },
45};45};
4646
47// glibc's naming of Zig architectures
48const Arch = enum(c_int) {
49 arm,
50 armeb,
51 aarch64,
52 aarch64_be,
53 mips,
54 mipsel,
55 mips64,
56 mips64el,
57 powerpc,
58 powerpc64,
59 powerpc64le,
60 riscv32,
61 riscv64,
62 sparc,
63 sparc64,
64 sparcel,
65 s390x,
66 i386,
67 x86_64,
68};
69
70pub const LoadMetaDataError = error{47pub const LoadMetaDataError = error{
71 /// The files that ship with the Zig compiler were unable to be read, or otherwise had malformed data.48 /// The files that ship with the Zig compiler were unable to be read, or otherwise had malformed data.
72 ZigInstallationCorrupt,49 ZigInstallationCorrupt,
...@@ -158,7 +135,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI...@@ -158,7 +135,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI
158 log.err("abilists: expected ABI name", .{});135 log.err("abilists: expected ABI name", .{});
159 return error.ZigInstallationCorrupt;136 return error.ZigInstallationCorrupt;
160 };137 };
161 const arch_tag = std.meta.stringToEnum(Arch, arch_name) orelse {138 const arch_tag = std.meta.stringToEnum(std.Target.Cpu.Arch, arch_name) orelse {
162 log.err("abilists: unrecognized arch: '{s}'", .{arch_name});139 log.err("abilists: unrecognized arch: '{s}'", .{arch_name});
163 return error.ZigInstallationCorrupt;140 return error.ZigInstallationCorrupt;
164 };141 };
...@@ -172,7 +149,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI...@@ -172,7 +149,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI
172 };149 };
173150
174 targets[i] = .{151 targets[i] = .{
175 .arch = glibcToZigArch(arch_tag),152 .arch = arch_tag,
176 .os = .linux,153 .os = .linux,
177 .abi = abi_tag,154 .abi = abi_tag,
178 };155 };
...@@ -1140,30 +1117,6 @@ fn buildSharedLib(...@@ -1140,30 +1117,6 @@ fn buildSharedLib(
1140 try sub_compilation.updateSubCompilation();1117 try sub_compilation.updateSubCompilation();
1141}1118}
11421119
1143fn glibcToZigArch(arch_tag: Arch) std.Target.Cpu.Arch {
1144 return switch (arch_tag) {
1145 .arm => .arm,
1146 .armeb => .armeb,
1147 .aarch64 => .aarch64,
1148 .aarch64_be => .aarch64_be,
1149 .mips => .mips,
1150 .mipsel => .mipsel,
1151 .mips64 => .mips64,
1152 .mips64el => .mips64el,
1153 .powerpc => .powerpc,
1154 .powerpc64 => .powerpc64,
1155 .powerpc64le => .powerpc64le,
1156 .riscv32 => .riscv32,
1157 .riscv64 => .riscv64,
1158 .sparc => .sparc,
1159 .sparc64 => .sparc64,
1160 .sparcel => .sparcel,
1161 .s390x => .s390x,
1162 .i386 => .i386,
1163 .x86_64 => .x86_64,
1164 };
1165}
1166
1167// Return true if glibc has crti/crtn sources for that architecture.1120// Return true if glibc has crti/crtn sources for that architecture.
1168pub fn needsCrtiCrtn(target: std.Target) bool {1121pub fn needsCrtiCrtn(target: std.Target) bool {
1169 return switch (target.cpu.arch) {1122 return switch (target.cpu.arch) {