authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-03-26 18:27:43+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-03-26 20:39:07+01:00
logd56a99442becc38a74dddd1189530c13e39e9b2a
tree003e55ab84f4c3df0410382b6f3a5c3f2cfaae02
parent0cf5f0d0b085e66eb5421b5bb8a179d9b7fad6db
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.process: Don't use _mh_execute_header in getBaseAddress() on BSDs.

Only the Mach-O format has this symbol.

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

lib/std/process.zig+1-1
...@@ -1660,7 +1660,7 @@ pub fn getBaseAddress() usize {...@@ -1660,7 +1660,7 @@ pub fn getBaseAddress() usize {
1660 const phdr = getauxval(std.elf.AT_PHDR);1660 const phdr = getauxval(std.elf.AT_PHDR);
1661 return phdr - @sizeOf(std.elf.Ehdr);1661 return phdr - @sizeOf(std.elf.Ehdr);
1662 },1662 },
1663 .macos, .freebsd, .netbsd => {1663 .macos => {
1664 return @intFromPtr(&std.c._mh_execute_header);1664 return @intFromPtr(&std.c._mh_execute_header);
1665 },1665 },
1666 .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)),1666 .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)),