authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-04 10:58:28+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-09-04 10:58:28+02:00
logd94e061ade545f3fbdd4ab1a18f860b05050ebf6
treed4524d99ab3748c71a826b09c26276bd7f699b45
parent9649ff37ef15aae06d4020ce3b7210fa2aaf2a25
parent210b764c03b736a6fe025b5fac030eec0350f0df
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25137 from alexrp/elf-gabi-4.3

ELF updates for gABI 4.3

6 files changed, 34 insertions(+), 20 deletions(-)

lib/std/Build/Step/CheckObject.zig+1-1
......@@ -2226,7 +2226,7 @@ const ElfDumper = struct {
22262226 try writer.print(" {s}", .{sym_bind});
22272227 }
22282228
2229 const sym_vis = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));
2229 const sym_vis = @as(elf.STV, @enumFromInt(@as(u3, @truncate(sym.st_other))));
22302230 try writer.print(" {s}", .{@tagName(sym_vis)});
22312231
22322232 const sym_name = switch (sym.st_type()) {
lib/std/elf.zig+27-13
......@@ -1122,17 +1122,17 @@ pub const OSABI = enum(u8) {
11221122 CLOUDABI = 17,
11231123 /// Stratus Technologies OpenVOS
11241124 OPENVOS = 18,
1125 /// NVIDIA CUDA architecture
1125 /// NVIDIA CUDA architecture (not gABI assigned)
11261126 CUDA = 51,
1127 /// AMD HSA Runtime
1127 /// AMD HSA Runtime (not gABI assigned)
11281128 AMDGPU_HSA = 64,
1129 /// AMD PAL Runtime
1129 /// AMD PAL Runtime (not gABI assigned)
11301130 AMDGPU_PAL = 65,
1131 /// AMD Mesa3D Runtime
1131 /// AMD Mesa3D Runtime (not gABI assigned)
11321132 AMDGPU_MESA3D = 66,
1133 /// ARM
1133 /// ARM (not gABI assigned)
11341134 ARM = 97,
1135 /// Standalone (embedded) application
1135 /// Standalone (embedded) application (not gABI assigned)
11361136 STANDALONE = 255,
11371137
11381138 _,
......@@ -1165,11 +1165,11 @@ pub const EM = enum(u16) {
11651165 S370 = 9,
11661166 /// MIPS R3000 (and R4000) little-endian, Oct 4 1993 Draft (deprecated)
11671167 MIPS_RS3_LE = 10,
1168 /// Old version of Sparc v9, from before the ABI (deprecated)
1168 /// Old version of Sparc v9, from before the ABI (not gABI assigned)
11691169 OLD_SPARCV9 = 11,
11701170 /// HPPA
11711171 PARISC = 15,
1172 /// Fujitsu VPP500 (also old version of PowerPC; deprecated)
1172 /// Fujitsu VPP500 (also old version of PowerPC, which was not gABI assigned)
11731173 VPP500 = 17,
11741174 /// Sun's "v8plus"
11751175 SPARC32PLUS = 18,
......@@ -1189,7 +1189,7 @@ pub const EM = enum(u16) {
11891189 FR20 = 37,
11901190 /// TRW RH32
11911191 RH32 = 38,
1192 /// Motorola M*Core, aka RCE (also Fujitsu MMA)
1192 /// Motorola M*Core, aka RCE (also old Fujitsu MMA, which was not gABI assigned)
11931193 MCORE = 39,
11941194 /// ARM
11951195 ARM = 40,
......@@ -1301,7 +1301,7 @@ pub const EM = enum(u16) {
13011301 ARC_COMPACT = 93,
13021302 /// Tensilica Xtensa Architecture
13031303 XTENSA = 94,
1304 /// Alphamosaic VideoCore processor (also old Sunplus S+core7 backend magic number)
1304 /// Alphamosaic VideoCore processor (also old Sunplus S+core7 backend magic number, which was not gABI assigned)
13051305 VIDEOCORE = 95,
13061306 /// Thompson Multimedia General Purpose Processor
13071307 TMM_GPP = 96,
......@@ -1309,7 +1309,7 @@ pub const EM = enum(u16) {
13091309 NS32K = 97,
13101310 /// Tenor Network TPC processor
13111311 TPC = 98,
1312 /// Trebia SNP 1000 processor (also old value for picoJava; deprecated)
1312 /// Trebia SNP 1000 processor (also old value for picoJava, which was not gABI assigned)
13131313 SNP1K = 99,
13141314 /// STMicroelectronics ST200 microcontroller
13151315 ST200 = 100,
......@@ -1341,7 +1341,7 @@ pub const EM = enum(u16) {
13411341 ALTERA_NIOS2 = 113,
13421342 /// National Semiconductor CRX
13431343 CRX = 114,
1344 /// Motorola XGATE embedded processor (also old value for National Semiconductor CompactRISC; deprecated)
1344 /// Motorola XGATE embedded processor (also old value for National Semiconductor CompactRISC, which was not gABI assigned)
13451345 XGATE = 115,
13461346 /// Infineon C16x/XC16x processor
13471347 C166 = 116,
......@@ -1377,6 +1377,8 @@ pub const EM = enum(u16) {
13771377 TI_C2000 = 141,
13781378 /// Texas Instruments TMS320C55x DSP family
13791379 TI_C5500 = 142,
1380 /// Texas Instruments Application Specific RISC Processor, 32bit fetch
1381 TI_ARP32 = 143,
13801382 /// Texas Instruments Programmable Realtime Unit
13811383 TI_PRU = 144,
13821384 /// STMicroelectronics 64bit VLIW Data Signal Processor
......@@ -1537,6 +1539,18 @@ pub const EM = enum(u16) {
15371539 TACHYUM = 261,
15381540 /// NXP 56800EF Digital Signal Controller (DSC)
15391541 @"56800EF" = 262,
1542 /// Solana Bytecode Format
1543 SBF = 263,
1544 /// AMD/Xilinx AIEngine architecture
1545 AIENGINE = 264,
1546 /// SiMa MLA
1547 SIMA_MLA = 265,
1548 /// Cambricon BANG
1549 BANG = 266,
1550 /// Loongson LoongGPU
1551 LOONGGPU = 267,
1552 /// Wuxi Institute of Advanced Technology SW64
1553 SW64 = 268,
15401554 /// AVR
15411555 AVR_OLD = 0x1057,
15421556 /// MSP430
......@@ -2289,7 +2303,7 @@ pub const R_PPC64 = enum(u32) {
22892303 _,
22902304};
22912305
2292pub const STV = enum(u2) {
2306pub const STV = enum(u3) {
22932307 DEFAULT = 0,
22942308 INTERNAL = 1,
22952309 HIDDEN = 2,
src/link/Elf/Object.zig+2-2
......@@ -634,7 +634,7 @@ pub fn claimUnresolved(self: *Object, elf_file: *Elf) void {
634634
635635 const is_import = blk: {
636636 if (!elf_file.isEffectivelyDynLib()) break :blk false;
637 const vis = @as(elf.STV, @enumFromInt(esym.st_other));
637 const vis: elf.STV = @enumFromInt(@as(u3, @truncate(esym.st_other)));
638638 if (vis == .HIDDEN) break :blk false;
639639 break :blk true;
640640 };
......@@ -707,7 +707,7 @@ pub fn markImportsExports(self: *Object, elf_file: *Elf) void {
707707 const file = sym.file(elf_file).?;
708708 // https://github.com/ziglang/zig/issues/21678
709709 if (@as(u16, @bitCast(sym.version_index)) == @as(u16, @bitCast(elf.Versym.LOCAL))) continue;
710 const vis: elf.STV = @enumFromInt(sym.elfSym(elf_file).st_other);
710 const vis: elf.STV = @enumFromInt(@as(u3, @truncate(sym.elfSym(elf_file).st_other)));
711711 if (vis == .HIDDEN) continue;
712712 if (file == .shared_object and !sym.isAbs(elf_file)) {
713713 sym.flags.import = true;
src/link/Elf/SharedObject.zig+1-1
......@@ -357,7 +357,7 @@ pub fn markImportExports(self: *SharedObject, elf_file: *Elf) void {
357357 const ref = self.resolveSymbol(@intCast(i), elf_file);
358358 const ref_sym = elf_file.symbol(ref) orelse continue;
359359 const ref_file = ref_sym.file(elf_file).?;
360 const vis = @as(elf.STV, @enumFromInt(ref_sym.elfSym(elf_file).st_other));
360 const vis: elf.STV = @enumFromInt(@as(u3, @truncate(ref_sym.elfSym(elf_file).st_other)));
361361 if (ref_file != .shared_object and vis != .HIDDEN) ref_sym.flags.@"export" = true;
362362 }
363363}
src/link/Elf/ZigObject.zig+2-2
......@@ -617,7 +617,7 @@ pub fn claimUnresolved(self: *ZigObject, elf_file: *Elf) void {
617617
618618 const is_import = blk: {
619619 if (!elf_file.isEffectivelyDynLib()) break :blk false;
620 const vis = @as(elf.STV, @enumFromInt(esym.st_other));
620 const vis: elf.STV = @enumFromInt(@as(u3, @truncate(esym.st_other)));
621621 if (vis == .HIDDEN) break :blk false;
622622 break :blk true;
623623 };
......@@ -695,7 +695,7 @@ pub fn markImportsExports(self: *ZigObject, elf_file: *Elf) void {
695695 const file = sym.file(elf_file).?;
696696 // https://github.com/ziglang/zig/issues/21678
697697 if (@as(u16, @bitCast(sym.version_index)) == @as(u16, @bitCast(elf.Versym.LOCAL))) continue;
698 const vis: elf.STV = @enumFromInt(sym.elfSym(elf_file).st_other);
698 const vis: elf.STV = @enumFromInt(@as(u3, @truncate(sym.elfSym(elf_file).st_other)));
699699 if (vis == .HIDDEN) continue;
700700 if (file == .shared_object and !sym.isAbs(elf_file)) {
701701 sym.flags.import = true;
tools/gen_stubs.zig+1-1
......@@ -608,7 +608,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
608608 const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0));
609609 const ty = @as(u4, @truncate(sym.st_info));
610610 const binding = @as(u4, @truncate(sym.st_info >> 4));
611 const visib = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));
611 const visib = @as(elf.STV, @enumFromInt(@as(u3, @truncate(sym.st_other))));
612612 const size = s(sym.st_size);
613613
614614 if (size == 0) {