authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-27 23:10:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-28 09:56:53+02:00
log89ed51bf5360f9abf07024e0a9f6c10382fbb624
treed77ef11b1b14057222796d0e77bba155048b890d
parent764760df62c63bc2a3d4bd4ec95c000233625834

link.Elf, link.Lld: executables should not have an image base on Haiku

Executables are always ET_DYN on Haiku, so like shared libraries, they should not have an image base set. Elf2 already got this right, but Elf and Lld didn't. closes https://codeberg.org/ziglang/zig/issues/32100

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

src/link/Elf.zig+1-1
......@@ -286,7 +286,7 @@ pub fn createEmpty(
286286
287287 .image_base = b: {
288288 if (is_dyn_lib) break :b 0;
289 if (output_mode == .Exe and comp.config.pie) break :b 0;
289 if (output_mode == .Exe and (comp.config.pie or target.os.tag == .haiku)) break :b 0;
290290 break :b options.image_base orelse switch (ptr_width) {
291291 .p32 => 0x10000,
292292 .p64 => 0x1000000,
src/link/Lld.zig+1-1
......@@ -126,7 +126,7 @@ pub const Elf = struct {
126126 .hash_style = options.hash_style,
127127 .image_base = b: {
128128 if (is_dyn_lib) break :b 0;
129 if (output_mode == .Exe and comp.config.pie) break :b 0;
129 if (output_mode == .Exe and (comp.config.pie or target.os.tag == .haiku)) break :b 0;
130130 break :b options.image_base orelse switch (ptr_width) {
131131 .p32 => 0x10000,
132132 .p64 => 0x1000000,