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(...@@ -286,7 +286,7 @@ pub fn createEmpty(
286286
287 .image_base = b: {287 .image_base = b: {
288 if (is_dyn_lib) break :b 0;288 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;
290 break :b options.image_base orelse switch (ptr_width) {290 break :b options.image_base orelse switch (ptr_width) {
291 .p32 => 0x10000,291 .p32 => 0x10000,
292 .p64 => 0x1000000,292 .p64 => 0x1000000,
src/link/Lld.zig+1-1
...@@ -126,7 +126,7 @@ pub const Elf = struct {...@@ -126,7 +126,7 @@ pub const Elf = struct {
126 .hash_style = options.hash_style,126 .hash_style = options.hash_style,
127 .image_base = b: {127 .image_base = b: {
128 if (is_dyn_lib) break :b 0;128 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;
130 break :b options.image_base orelse switch (ptr_width) {130 break :b options.image_base orelse switch (ptr_width) {
131 .p32 => 0x10000,131 .p32 => 0x10000,
132 .p64 => 0x1000000,132 .p64 => 0x1000000,