mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std.process: Fix getBaseAddress() for linux + libc.
In this case we should use the getauxval() from libc, not our own.
This commit is contained in:
parent
b84db311d9
commit
0cf5f0d0b0
1 changed files with 3 additions and 2 deletions
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue