src/glibc: remove redundant Arch

abilists now use Zig's arch, no need for a separate one.
This commit is contained in:
Motiejus Jakštys 2022-08-25 16:46:32 +03:00
parent ea785f70ef
commit 29e90efbb1

View File

@ -44,29 +44,6 @@ pub const libs = [_]Lib{
.{ .name = "resolv", .sover = 2 },
};
// glibc's naming of Zig architectures
const Arch = enum(c_int) {
arm,
armeb,
aarch64,
aarch64_be,
mips,
mipsel,
mips64,
mips64el,
powerpc,
powerpc64,
powerpc64le,
riscv32,
riscv64,
sparc,
sparc64,
sparcel,
s390x,
i386,
x86_64,
};
pub const LoadMetaDataError = error{
/// The files that ship with the Zig compiler were unable to be read, or otherwise had malformed data.
ZigInstallationCorrupt,
@ -158,7 +135,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI
log.err("abilists: expected ABI name", .{});
return error.ZigInstallationCorrupt;
};
const arch_tag = std.meta.stringToEnum(Arch, arch_name) orelse {
const arch_tag = std.meta.stringToEnum(std.Target.Cpu.Arch, arch_name) orelse {
log.err("abilists: unrecognized arch: '{s}'", .{arch_name});
return error.ZigInstallationCorrupt;
};
@ -172,7 +149,7 @@ pub fn loadMetaData(gpa: Allocator, zig_lib_dir: fs.Dir) LoadMetaDataError!*ABI
};
targets[i] = .{
.arch = glibcToZigArch(arch_tag),
.arch = arch_tag,
.os = .linux,
.abi = abi_tag,
};
@ -1140,30 +1117,6 @@ fn buildSharedLib(
try sub_compilation.updateSubCompilation();
}
fn glibcToZigArch(arch_tag: Arch) std.Target.Cpu.Arch {
return switch (arch_tag) {
.arm => .arm,
.armeb => .armeb,
.aarch64 => .aarch64,
.aarch64_be => .aarch64_be,
.mips => .mips,
.mipsel => .mipsel,
.mips64 => .mips64,
.mips64el => .mips64el,
.powerpc => .powerpc,
.powerpc64 => .powerpc64,
.powerpc64le => .powerpc64le,
.riscv32 => .riscv32,
.riscv64 => .riscv64,
.sparc => .sparc,
.sparc64 => .sparc64,
.sparcel => .sparcel,
.s390x => .s390x,
.i386 => .i386,
.x86_64 => .x86_64,
};
}
// Return true if glibc has crti/crtn sources for that architecture.
pub fn needsCrtiCrtn(target: std.Target) bool {
return switch (target.cpu.arch) {