| ... | @@ -1652,14 +1652,15 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo { | ... | @@ -1652,14 +1652,15 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo { |
| 1652 | pub fn getBaseAddress() usize { | 1652 | pub fn getBaseAddress() usize { |
| 1653 | switch (native_os) { | 1653 | switch (native_os) { |
| 1654 | .linux => { | 1654 | .linux => { |
| 1655 | const base = std.os.linux.getauxval(std.elf.AT_BASE); | 1655 | const getauxval = if (builtin.link_libc) std.c.getauxval else std.os.linux.getauxval; |
| | 1656 | const base = getauxval(std.elf.AT_BASE); |
| 1656 | if (base != 0) { | 1657 | if (base != 0) { |
| 1657 | return base; | 1658 | return base; |
| 1658 | } | 1659 | } |
| 1659 | const phdr = std.os.linux.getauxval(std.elf.AT_PHDR); | 1660 | const phdr = getauxval(std.elf.AT_PHDR); |
| 1660 | return phdr - @sizeOf(std.elf.Ehdr); | 1661 | return phdr - @sizeOf(std.elf.Ehdr); |
| 1661 | }, | 1662 | }, |
| 1662 | .macos, .freebsd, .netbsd => { | 1663 | .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { |
| 1663 | return @intFromPtr(&std.c._mh_execute_header); | 1664 | return @intFromPtr(&std.c._mh_execute_header); |
| 1664 | }, | 1665 | }, |
| 1665 | .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)), | 1666 | .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)), |