From ea006188aaf110a33cbf0ca00888306f263cce98 Mon Sep 17 00:00:00 2001 From: David Senoner Date: Wed, 29 Jul 2026 14:08:23 +0200 Subject: [PATCH] elf: remove all deprecated usages and definitions of std.elf.PT_* --- lib/compiler/objcopy.zig | 2 +- lib/std/Build/Step/Compile.zig | 2 +- lib/std/dynamic_library.zig | 8 ++-- lib/std/elf.zig | 41 -------------------- lib/std/os/linux/tls.zig | 8 ++-- lib/std/os/linux/vdso.zig | 4 +- lib/std/pie.zig | 2 +- lib/std/posix/test.zig | 2 +- lib/std/start.zig | 4 +- lib/std/zig/system.zig | 8 ++-- src/link/Elf.zig | 70 +++++++++++++++++----------------- src/link/Lld.zig | 4 +- 12 files changed, 57 insertions(+), 98 deletions(-) diff --git a/lib/compiler/objcopy.zig b/lib/compiler/objcopy.zig index 857299a60e16f410c3eb54ca6be8382c33b99567..136b48ef4c0cbadfd6f9309bfda8660fedb613d0 100644 --- a/lib/compiler/objcopy.zig +++ b/lib/compiler/objcopy.zig @@ -435,7 +435,7 @@ const BinaryElfOutput = struct { var program_headers = elf_hdr.iterateProgramHeaders(in); while (try program_headers.next()) |phdr| { - if (phdr.p_type == elf.PT_LOAD) { + if (phdr.p_type == @backingInt(elf.PT.LOAD)) { const newSegment = try allocator.create(BinaryElfSegment); newSegment.physicalAddress = phdr.p_paddr; diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index b14e0c254846d0bda46e06f735015f877dcf9a36..90d88f3a20785f3cb892b080212b8cda9afd5f88 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -101,7 +101,7 @@ each_lib_rpath: ?bool = null, /// This option overrides the CLI argument passed to `zig build`. build_id: ?std.zig.BuildId = null, -/// Create a .eh_frame_hdr section and a PT_GNU_EH_FRAME segment in the ELF +/// Create a .eh_frame_hdr section and a PT.GNU_EH_FRAME segment in the ELF /// file. link_eh_frame_hdr: bool = false, link_emit_relocs: bool = false, diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index 0161644439803e7fc6dd4fbb1c1610235d97b5e0..767821f9ffe6743e1a5579ea6e231c22e5635124 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -103,7 +103,7 @@ pub fn get_DYNAMIC() ?[*]const elf.Dyn { pub fn linkmap_iterator() error{InvalidExe}!LinkMap.Iterator { const _DYNAMIC = get_DYNAMIC() orelse { - // No PT_DYNAMIC means this is a statically-linked non-PIE program. + // No PT.DYNAMIC means this is a statically-linked non-PIE program. return .{ .current = null }; }; @@ -263,8 +263,8 @@ pub const ElfDynLib = struct { }) { const ph = @as(*elf.Phdr, @ptrFromInt(ph_addr)); switch (ph.p_type) { - elf.PT_LOAD => virt_addr_end = @max(virt_addr_end, ph.p_vaddr + ph.p_memsz), - elf.PT_DYNAMIC => maybe_dynv = @as([*]usize, @ptrFromInt(elf_addr + ph.p_offset)), + @backingInt(elf.PT.LOAD) => virt_addr_end = @max(virt_addr_end, ph.p_vaddr + ph.p_memsz), + @backingInt(elf.PT.DYNAMIC) => maybe_dynv = @as([*]usize, @ptrFromInt(elf_addr + ph.p_offset)), else => {}, } } @@ -294,7 +294,7 @@ pub const ElfDynLib = struct { }) { const ph = @as(*elf.Phdr, @ptrFromInt(ph_addr)); switch (ph.p_type) { - elf.PT_LOAD => { + @backingInt(elf.PT.LOAD) => { // The VirtAddr may not be page-aligned; in such case there will be // extra nonsense mapped before/after the VirtAddr,MemSiz const aligned_addr = (base + ph.p_vaddr) & ~(@as(usize, page_size) - 1); diff --git a/lib/std/elf.zig b/lib/std/elf.zig index e96cb50f97512239ff86e648d4dabd91eb5f01e4..d731f44289673ae800438ac34310400ed690ec85 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -290,47 +290,6 @@ pub const VER_FLG_BASE = 1; /// Weak version identifier pub const VER_FLG_WEAK = 2; -/// Deprecated, use `@intFromEnum(std.elf.PT.NULL)` -pub const PT_NULL = @backingInt(std.elf.PT.NULL); -/// Deprecated, use `@intFromEnum(std.elf.PT.LOAD)` -pub const PT_LOAD = @backingInt(std.elf.PT.LOAD); -/// Deprecated, use `@intFromEnum(std.elf.PT.DYNAMIC)` -pub const PT_DYNAMIC = @backingInt(std.elf.PT.DYNAMIC); -/// Deprecated, use `@intFromEnum(std.elf.PT.INTERP)` -pub const PT_INTERP = @backingInt(std.elf.PT.INTERP); -/// Deprecated, use `@intFromEnum(std.elf.PT.NOTE)` -pub const PT_NOTE = @backingInt(std.elf.PT.NOTE); -/// Deprecated, use `@intFromEnum(std.elf.PT.SHLIB)` -pub const PT_SHLIB = @backingInt(std.elf.PT.SHLIB); -/// Deprecated, use `@intFromEnum(std.elf.PT.PHDR)` -pub const PT_PHDR = @backingInt(std.elf.PT.PHDR); -/// Deprecated, use `@intFromEnum(std.elf.PT.TLS)` -pub const PT_TLS = @backingInt(std.elf.PT.TLS); -/// Deprecated, use `std.elf.PT.NUM`. -pub const PT_NUM = PT.NUM; -/// Deprecated, use `@intFromEnum(std.elf.PT.LOOS)` -pub const PT_LOOS = @backingInt(std.elf.PT.LOOS); -/// Deprecated, use `@intFromEnum(std.elf.PT.GNU_EH_FRAME)` -pub const PT_GNU_EH_FRAME = @backingInt(std.elf.PT.GNU_EH_FRAME); -/// Deprecated, use `@intFromEnum(std.elf.PT.GNU_STACK)` -pub const PT_GNU_STACK = @backingInt(std.elf.PT.GNU_STACK); -/// Deprecated, use `@intFromEnum(std.elf.PT.GNU_RELRO)` -pub const PT_GNU_RELRO = @backingInt(std.elf.PT.GNU_RELRO); -/// Deprecated, use `@intFromEnum(std.elf.PT.LOSUNW)` -pub const PT_LOSUNW = @backingInt(std.elf.PT.LOSUNW); -/// Deprecated, use `@intFromEnum(std.elf.PT.SUNWBSS)` -pub const PT_SUNWBSS = @backingInt(std.elf.PT.SUNWBSS); -/// Deprecated, use `@intFromEnum(std.elf.PT.SUNWSTACK)` -pub const PT_SUNWSTACK = @backingInt(std.elf.PT.SUNWSTACK); -/// Deprecated, use `@intFromEnum(std.elf.PT.HISUNW)` -pub const PT_HISUNW = @backingInt(std.elf.PT.HISUNW); -/// Deprecated, use `@intFromEnum(std.elf.PT.HIOS)` -pub const PT_HIOS = @backingInt(std.elf.PT.HIOS); -/// Deprecated, use `@intFromEnum(std.elf.PT.LOPROC)` -pub const PT_LOPROC = @backingInt(std.elf.PT.LOPROC); -/// Deprecated, use `@intFromEnum(std.elf.PT.HIPROC)` -pub const PT_HIPROC = @backingInt(std.elf.PT.HIPROC); - pub const PN_XNUM = 0xffff; /// Deprecated, use `@intFromEnum(std.elf.SHT.NULL)` diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index e02ba39840497e2dec5d55ed1a7bb4a05b17ad01..79664061b1de96bbc00cf0714e4d8a82a5aa5f88 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -22,7 +22,7 @@ const page_size_min = std.heap.page_size_min; /// Represents an ELF TLS variant. /// /// In all variants, the TP and the TLS blocks must be aligned to the `p_align` value in the -/// `PT_TLS` ELF program header. Everything else has natural alignment. +/// `PT.TLS` ELF program header. Everything else has natural alignment. /// /// The location of the DTV does not actually matter. For simplicity, we put it in the TLS area, but /// there is no actual ABI requirement that it reside there. @@ -489,8 +489,8 @@ fn computeAreaDesc(phdrs: []elf.Phdr) void { for (phdrs) |*phdr| { switch (phdr.p_type) { - elf.PT_PHDR => img_base = @intFromPtr(phdrs.ptr) - phdr.p_vaddr, - elf.PT_TLS => tls_phdr = phdr, + @backingInt(elf.PT.PHDR) => img_base = @intFromPtr(phdrs.ptr) - phdr.p_vaddr, + @backingInt(elf.PT.TLS) => tls_phdr = phdr, else => {}, } } @@ -503,7 +503,7 @@ fn computeAreaDesc(phdrs: []elf.Phdr) void { align_factor = phdr.p_align; // The effective size in memory is represented by `p_memsz`; the length of the data stored - // in the `PT_TLS` segment is `p_filesz` and may be less than the former. + // in the `PT.TLS` segment is `p_filesz` and may be less than the former. block_init = @as([*]u8, @ptrFromInt(img_base + phdr.p_vaddr))[0..phdr.p_filesz]; block_size = phdr.p_memsz; } else { diff --git a/lib/std/os/linux/vdso.zig b/lib/std/os/linux/vdso.zig index 1106ee8bf173dd6eaff0fe372e490249d91dd89f..cc058b7ffcc3ab64f0fc7beaf0afa233d3514483 100644 --- a/lib/std/os/linux/vdso.zig +++ b/lib/std/os/linux/vdso.zig @@ -25,8 +25,8 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { // of the memory space (e.g. p_vaddr = 0xffffffffff700000 on WSL1). // Wrapping operations are used on this line as well as subsequent calculations relative to base // (lines 47, 78) to ensure no overflow check is tripped. - elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr, - elf.PT_DYNAMIC => maybe_dynv = @as([*]usize, @ptrFromInt(vdso_addr + this_ph.p_offset)), + @backingInt(elf.PT.LOAD) => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr, + @backingInt(elf.PT.DYNAMIC) => maybe_dynv = @as([*]usize, @ptrFromInt(vdso_addr + this_ph.p_offset)), else => {}, } } diff --git a/lib/std/pie.zig b/lib/std/pie.zig index 0252cde9e8f0161ae5a3767723c3853f94ec82f0..498fe3672e1c6e10fa940f40f2dcc380b2c49f63 100644 --- a/lib/std/pie.zig +++ b/lib/std/pie.zig @@ -303,7 +303,7 @@ pub fn relocate(phdrs: []const elf.Phdr) void { // the theoretical load addresses for the `_DYNAMIC` symbol. const base_addr = base: { for (phdrs) |*phdr| { - if (phdr.p_type != elf.PT_DYNAMIC) continue; + if (phdr.p_type != @backingInt(elf.PT.DYNAMIC)) continue; break :base @intFromPtr(dynv) - phdr.p_vaddr; } // This is not supposed to happen for well-formed binaries. diff --git a/lib/std/posix/test.zig b/lib/std/posix/test.zig index 8accb90cb7f9c79b3246fb974c838c9c28e7245d..4fb68855b5a5953b709fae4f893bc051a50dbf09 100644 --- a/lib/std/posix/test.zig +++ b/lib/std/posix/test.zig @@ -75,7 +75,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { // Count how many libraries are loaded counter.* += @as(usize, 1); - // The image should contain at least a PT_LOAD segment + // The image should contain at least a PT.LOAD segment if (info.phnum < 1) return error.MissingPtLoadSegment; // Quick & dirty validation of the phdr pointers, make sure we're not diff --git a/lib/std/start.zig b/lib/std/start.zig index 2530b80d360c4e9b61bb8f2d4e25006d20aea2c3..cd72a52847d60eaa5dd30bd0a161ddff99bfc3f0 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -621,7 +621,7 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.c) noreturn { std.os.linux.tls.initStatic(phdrs); } - // The way Linux executables represent stack size is via the PT_GNU_STACK + // The way Linux executables represent stack size is via the PT.GNU_STACK // program header. However the kernel does not recognize it; it always gives 8 MiB. // Here we look for the stack size in our program headers and use setrlimit // to ask for more stack space. @@ -649,7 +649,7 @@ fn expandStackSize(phdrs: []elf.Phdr) void { @disableInstrumentation(); for (phdrs) |*phdr| { switch (phdr.p_type) { - elf.PT_GNU_STACK => { + @backingInt(elf.PT.GNU_STACK) => { if (phdr.p_memsz == 0) break; assert(phdr.p_memsz % std.heap.page_size_min == 0); diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 060fd1d97643beac4e5724a12ea26427e7500a31..083e7bb90f0ffb5acabf3470414262834e3cb0b1 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -597,14 +597,14 @@ fn abiAndDynamicLinkerFromFile( .ofmt = query.ofmt orelse Target.ObjectFormat.default(os.tag, cpu.arch), .dynamic_linker = query.dynamic_linker orelse .none, }; - var rpath_offset: ?u64 = null; // Found inside PT_DYNAMIC + var rpath_offset: ?u64 = null; // Found inside PT.DYNAMIC const look_for_ld = query.dynamic_linker == null; var got_dyn_section: bool = false; { var it = header.iterateProgramHeaders(file_reader); while (try it.next()) |phdr| switch (phdr.p_type) { - elf.PT_INTERP => { + @backingInt(elf.PT.INTERP) => { got_dyn_section = true; if (look_for_ld) { @@ -613,7 +613,7 @@ fn abiAndDynamicLinkerFromFile( const filesz: usize = @intCast(p_filesz); try file_reader.seekTo(phdr.p_offset); try file_reader.interface.readSliceAll(result.dynamic_linker.buffer[0..filesz]); - // PT_INTERP includes a null byte in filesz. + // PT.INTERP includes a null byte in filesz. const len = filesz - 1; // dynamic_linker.max_byte is "max", not "len". // We know it will fit in u8 because we check against dynamic_linker.buffer.len above. @@ -631,7 +631,7 @@ fn abiAndDynamicLinkerFromFile( } }, // We only need this for detecting glibc version. - elf.PT_DYNAMIC => { + @backingInt(elf.PT.DYNAMIC) => { got_dyn_section = true; if (builtin.target.os.tag == .linux and result.isGnuLibC() and query.glibc_version == null) { diff --git a/src/link/Elf.zig b/src/link/Elf.zig index cda6d5321069bfe23b53efb10eb6dc6da8a0bc6d..de53f98bd5d3a83bd548d4c8b7d41b57a60d2cba 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -159,21 +159,21 @@ const ProgramHeaderIndex = enum(u16) { }; const ProgramHeaderIndexes = struct { - /// PT_PHDR + /// PT.PHDR table: OptionalProgramHeaderIndex = .none, - /// PT_LOAD for PHDR table + /// PT.LOAD for PHDR table /// We add this special load segment to ensure the EHDR and PHDR table are always /// loaded into memory. table_load: OptionalProgramHeaderIndex = .none, - /// PT_INTERP + /// PT.INTERP interp: OptionalProgramHeaderIndex = .none, - /// PT_DYNAMIC + /// PT.DYNAMIC dynamic: OptionalProgramHeaderIndex = .none, - /// PT_GNU_EH_FRAME + /// PT.GNU_EH_FRAME gnu_eh_frame: OptionalProgramHeaderIndex = .none, - /// PT_GNU_STACK + /// PT.GNU_STACK gnu_stack: OptionalProgramHeaderIndex = .none, - /// PT_TLS + /// PT.TLS /// TODO I think ELF permits multiple TLS segments but for now, assume one per file. tls: OptionalProgramHeaderIndex = .none, }; @@ -334,7 +334,7 @@ pub fn createEmpty( if (!is_obj_or_ar) { try self.dynstrtab.append(gpa, 0); - // Initialize PT_PHDR program header + // Initialize PT.PHDR program header const p_align: u16 = switch (self.ptr_width) { .p32 => @alignOf(elf.Elf32_Phdr), .p64 => @alignOf(elf.Elf64_Phdr), @@ -350,7 +350,7 @@ pub fn createEmpty( const max_nphdrs = comptime getMaxNumberOfPhdrs(); const reserved: u64 = mem.alignForward(u64, padToIdeal(max_nphdrs * phsize), self.page_size); self.phdr_indexes.table = (try self.addPhdr(.{ - .type = elf.PT_PHDR, + .type = @backingInt(elf.PT.PHDR), .flags = elf.PF_R, .@"align" = p_align, .addr = self.image_base + ehsize, @@ -359,7 +359,7 @@ pub fn createEmpty( .memsz = reserved, })).toOptional(); self.phdr_indexes.table_load = (try self.addPhdr(.{ - .type = elf.PT_LOAD, + .type = @backingInt(elf.PT.LOAD), .flags = elf.PF_R, .@"align" = self.page_size, .addr = self.image_base, @@ -514,7 +514,7 @@ fn detectAllocCollision(self: *Elf, start: u64, size: u64) !?u64 { } for (self.phdrs.items) |phdr| { - if (phdr.p_type != elf.PT_LOAD) continue; + if (phdr.p_type != @backingInt(elf.PT.LOAD)) continue; const increased_size = padToIdeal(phdr.p_filesz); const test_end = phdr.p_offset +| increased_size; if (start < test_end) { @@ -2091,26 +2091,26 @@ fn initSpecialPhdrs(self: *Elf) !void { if (self.section_indexes.interp != null and self.phdr_indexes.interp == .none) { self.phdr_indexes.interp = (try self.addPhdr(.{ - .type = elf.PT_INTERP, + .type = @backingInt(elf.PT.INTERP), .flags = elf.PF_R, .@"align" = 1, })).toOptional(); } if (self.section_indexes.dynamic != null and self.phdr_indexes.dynamic == .none) { self.phdr_indexes.dynamic = (try self.addPhdr(.{ - .type = elf.PT_DYNAMIC, + .type = @backingInt(elf.PT.DYNAMIC), .flags = elf.PF_R | elf.PF_W, })).toOptional(); } if (self.section_indexes.eh_frame_hdr != null and self.phdr_indexes.gnu_eh_frame == .none) { self.phdr_indexes.gnu_eh_frame = (try self.addPhdr(.{ - .type = elf.PT_GNU_EH_FRAME, + .type = @backingInt(elf.PT.GNU_EH_FRAME), .flags = elf.PF_R, })).toOptional(); } if (self.phdr_indexes.gnu_stack == .none) { self.phdr_indexes.gnu_stack = (try self.addPhdr(.{ - .type = elf.PT_GNU_STACK, + .type = @backingInt(elf.PT.GNU_STACK), .flags = elf.PF_W | elf.PF_R, .memsz = self.base.stack_size, .@"align" = 1, @@ -2122,7 +2122,7 @@ fn initSpecialPhdrs(self: *Elf) !void { } else false; if (has_tls and self.phdr_indexes.tls == .none) { self.phdr_indexes.tls = (try self.addPhdr(.{ - .type = elf.PT_TLS, + .type = @backingInt(elf.PT.TLS), .flags = elf.PF_R, .@"align" = 1, })).toOptional(); @@ -2262,13 +2262,13 @@ fn setHashSections(self: *Elf) !void { fn phdrRank(phdr: elf.Elf64_Phdr) u8 { return switch (phdr.p_type) { - elf.PT_NULL => 0, - elf.PT_PHDR => 1, - elf.PT_INTERP => 2, - elf.PT_LOAD => 3, - elf.PT_DYNAMIC, elf.PT_TLS => 4, - elf.PT_GNU_EH_FRAME => 5, - elf.PT_GNU_STACK => 6, + @backingInt(elf.PT.NULL) => 0, + @backingInt(elf.PT.PHDR) => 1, + @backingInt(elf.PT.INTERP) => 2, + @backingInt(elf.PT.LOAD) => 3, + @backingInt(elf.PT.DYNAMIC), @backingInt(elf.PT.TLS) => 4, + @backingInt(elf.PT.GNU_EH_FRAME) => 5, + @backingInt(elf.PT.GNU_STACK) => 6, else => 7, }; } @@ -2655,8 +2655,8 @@ fn addLoadPhdrs(self: *Elf) error{OutOfMemory}!void { if (shdr.sh_type == elf.SHT_NULL) continue; if (shdr.sh_flags & elf.SHF_ALLOC == 0) continue; const flags = shdrToPhdrFlags(shdr.sh_flags); - if (self.getPhdr(.{ .flags = flags, .type = elf.PT_LOAD }) == .none) { - _ = try self.addPhdr(.{ .flags = flags, .type = elf.PT_LOAD }); + if (self.getPhdr(.{ .flags = flags, .type = @backingInt(elf.PT.LOAD) }) == .none) { + _ = try self.addPhdr(.{ .flags = flags, .type = @backingInt(elf.PT.LOAD) }); } } } @@ -2817,7 +2817,7 @@ pub fn allocateAllocSections(self: *Elf) !void { } const first = slice.items(.shdr)[cover.items[0]]; - const phndx = self.getPhdr(.{ .type = elf.PT_LOAD, .flags = shdrToPhdrFlags(first.sh_flags) }).unwrap().?; + const phndx = self.getPhdr(.{ .type = @backingInt(elf.PT.LOAD), .flags = shdrToPhdrFlags(first.sh_flags) }).unwrap().?; const phdr = &self.phdrs.items[phndx.int()]; const allocated_size = self.allocatedSize(phdr.p_offset); if (filesz > allocated_size) { @@ -3906,15 +3906,15 @@ fn formatPhdr(ctx: FormatPhdr, writer: *std.Io.Writer) std.Io.Writer.Error!void if (write) flags[1] = 'W'; if (read) flags[2] = 'R'; const p_type = switch (phdr.p_type) { - elf.PT_LOAD => "LOAD", - elf.PT_TLS => "TLS", - elf.PT_GNU_EH_FRAME => "GNU_EH_FRAME", - elf.PT_GNU_STACK => "GNU_STACK", - elf.PT_DYNAMIC => "DYNAMIC", - elf.PT_INTERP => "INTERP", - elf.PT_NULL => "NULL", - elf.PT_PHDR => "PHDR", - elf.PT_NOTE => "NOTE", + @backingInt(elf.PT.LOAD) => "LOAD", + @backingInt(elf.PT.TLS) => "TLS", + @backingInt(elf.PT.GNU_EH_FRAME) => "GNU_EH_FRAME", + @backingInt(elf.PT.GNU_STACK) => "GNU_STACK", + @backingInt(elf.PT.DYNAMIC) => "DYNAMIC", + @backingInt(elf.PT.INTERP) => "INTERP", + @backingInt(elf.PT.NULL) => "NULL", + @backingInt(elf.PT.PHDR) => "PHDR", + @backingInt(elf.PT.NOTE) => "NOTE", else => "UNKNOWN", }; try writer.print("{s} : {s} : @{x} ({x}) : align({x}) : filesz({x}) : memsz({x})", .{ diff --git a/src/link/Lld.zig b/src/link/Lld.zig index cf64d3fd5bc51817cc86a7554ac65ee7aa53e373..62b92f00e56db89b856acf5927f670273dcc2b92 100644 --- a/src/link/Lld.zig +++ b/src/link/Lld.zig @@ -1021,8 +1021,8 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { } if (is_exe_or_dyn_lib and target.os.tag == .netbsd) { - // Add options to produce shared objects with only 2 PT_LOAD segments. - // NetBSD expects 2 PT_LOAD segments in a shared object, otherwise + // Add options to produce shared objects with only 2 PT.LOAD segments. + // NetBSD expects 2 PT.LOAD segments in a shared object, otherwise // ld.elf_so fails loading dynamic libraries with "not found" error. // See https://github.com/ziglang/zig/issues/9109 . try argv.append("--no-rosegment"); -- 2.54.0