diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-03-27 15:39:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-27 15:39:24 +0100 |
| commit | cc9634a2d3ac3ee7ec36e16ab9117aad6e2da625 (patch) | |
| tree | 8b313771a3ddd68ea00593dae43d98526d414188 /lib/std | |
| parent | b5a5260546ddd8953e493f75c5ee12c5a853263b (diff) | |
| parent | b9efdbb412fa9e5691553eca49aacd31e9d7ff69 (diff) | |
| download | zig-cc9634a2d3ac3ee7ec36e16ab9117aad6e2da625.tar.gz zig-cc9634a2d3ac3ee7ec36e16ab9117aad6e2da625.zip | |
Merge pull request #23373 from alexrp/get-base-address
`std.process`: Some minor fixes for `getBaseAddress()`
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/process.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig index b734276444..c2d18086fc 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -1652,14 +1652,15 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo { pub fn getBaseAddress() usize { switch (native_os) { .linux => { - const base = std.os.linux.getauxval(std.elf.AT_BASE); + const getauxval = if (builtin.link_libc) std.c.getauxval else std.os.linux.getauxval; + const base = getauxval(std.elf.AT_BASE); if (base != 0) { return base; } - const phdr = std.os.linux.getauxval(std.elf.AT_PHDR); + const phdr = getauxval(std.elf.AT_PHDR); return phdr - @sizeOf(std.elf.Ehdr); }, - .macos, .freebsd, .netbsd => { + .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { return @intFromPtr(&std.c._mh_execute_header); }, .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)), |
