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

Only the Mach-O format has this symbol.
This commit is contained in:
Alex Rønne Petersen 2025-03-26 18:27:43 +01:00
parent 0cf5f0d0b0
commit d56a99442b
No known key found for this signature in database

View File

@ -1660,7 +1660,7 @@ pub fn getBaseAddress() usize {
const phdr = getauxval(std.elf.AT_PHDR);
return phdr - @sizeOf(std.elf.Ehdr);
},
.macos, .freebsd, .netbsd => {
.macos => {
return @intFromPtr(&std.c._mh_execute_header);
},
.windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)),