aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-03-26 18:26:48 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2025-03-26 20:39:07 +0100
commit0cf5f0d0b085e66eb5421b5bb8a179d9b7fad6db (patch)
tree64ffbae1c26be295d20b35ec85415086208b305f /lib/std/process.zig
parentb84db311d90d722c206a7eea5464f46fd1b9e827 (diff)
downloadzig-0cf5f0d0b085e66eb5421b5bb8a179d9b7fad6db.tar.gz
zig-0cf5f0d0b085e66eb5421b5bb8a179d9b7fad6db.zip
std.process: Fix getBaseAddress() for linux + libc.
In this case we should use the getauxval() from libc, not our own.
Diffstat (limited to 'lib/std/process.zig')
-rw-r--r--lib/std/process.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig
index b734276444..3320513b0f 100644
--- a/lib/std/process.zig
+++ b/lib/std/process.zig
@@ -1652,11 +1652,12 @@ 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 => {