Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AT_* constants for musl libc #2121

Closed
ericonr opened this issue Mar 24, 2021 · 1 comment · Fixed by #2122
Closed

Add AT_* constants for musl libc #2121

ericonr opened this issue Mar 24, 2021 · 1 comment · Fixed by #2122
Labels
C-API-request Category: API request

Comments

@ericonr
Copy link

ericonr commented Mar 24, 2021

target: x86_64-unknown-linux-musl

minidump_linux_writer (part of firefox) fails to build on musl because these constants are missing (the getregs issue is separate):

 5:39.87    Compiling minidump_writer_linux v0.1.0 (https://github.com/msirringhaus/minidump_writer_linux.git?rev=9191af36343846b2c7ada65b9602b481b717c4d8#9191af36)
 5:40.22 error[E0425]: cannot find value `AT_NULL` in crate `libc`
 5:40.22     --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/auxv_reader.rs:98:29
 5:40.22      |
 5:40.22 98   |             at_null = libc::AT_NULL;
 5:40.22      |                             ^^^^^^^ help: a constant with a similar name exists: `PT_NULL`
 5:40.22      |
 5:40.22     ::: /builddir/firefox-87.0/third_party/rust/libc/src/unix/linux_like/linux/mod.rs:1614:1
 5:40.22      |
 5:40.22 1614 | pub const PT_NULL: u32 = 0;
 5:40.22      | --------------------------- similarly named constant `PT_NULL` defined here
 5:40.22 error[E0425]: cannot find value `AT_PHDR` in crate `libc`
 5:40.22     --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/dso_debug.rs:91:25
 5:40.22      |
 5:40.22 91   |         at_phdr = libc::AT_PHDR;
 5:40.22      |                         ^^^^^^^ help: a constant with a similar name exists: `PT_PHDR`
 5:40.22      |
 5:40.22     ::: /builddir/firefox-87.0/third_party/rust/libc/src/unix/linux_like/linux/mod.rs:1620:1
 5:40.22      |
 5:40.22 1620 | pub const PT_PHDR: u32 = 6;
 5:40.22      | --------------------------- similarly named constant `PT_PHDR` defined here
 5:40.22 error[E0425]: cannot find value `AT_PHNUM` in crate `libc`
 5:40.22   --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/dso_debug.rs:92:26
 5:40.22    |
 5:40.22 92 |         at_phnum = libc::AT_PHNUM;
 5:40.22    |                          ^^^^^^^^ not found in `libc`
 5:40.22 error[E0425]: cannot find function `getregs` in module `ptrace`
 5:40.22    --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:121:32
 5:40.22     |
 5:40.22 121 |             let regs = ptrace::getregs(pid);
 5:40.22     |                                ^^^^^^^ not found in `ptrace`
 5:40.22 error[E0425]: cannot find value `AT_ENTRY` in crate `libc`
 5:40.22    --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:241:30
 5:40.22     |
 5:40.22 241 |             at_entry = libc::AT_ENTRY;
 5:40.22     |                              ^^^^^^^^ not found in `libc`

They are defined in include/elf.h on musl, and are defined for glibc in

pub const AT_NULL: ::c_ulong = 0;
pub const AT_IGNORE: ::c_ulong = 1;
pub const AT_EXECFD: ::c_ulong = 2;
pub const AT_PHDR: ::c_ulong = 3;
pub const AT_PHENT: ::c_ulong = 4;
pub const AT_PHNUM: ::c_ulong = 5;
pub const AT_PAGESZ: ::c_ulong = 6;
pub const AT_BASE: ::c_ulong = 7;
pub const AT_FLAGS: ::c_ulong = 8;
pub const AT_ENTRY: ::c_ulong = 9;
pub const AT_NOTELF: ::c_ulong = 10;
pub const AT_UID: ::c_ulong = 11;
pub const AT_EUID: ::c_ulong = 12;
pub const AT_GID: ::c_ulong = 13;
pub const AT_EGID: ::c_ulong = 14;
pub const AT_PLATFORM: ::c_ulong = 15;
pub const AT_HWCAP: ::c_ulong = 16;
pub const AT_CLKTCK: ::c_ulong = 17;
// AT_* values 18 through 22 are reserved
pub const AT_SECURE: ::c_ulong = 23;
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
pub const AT_RANDOM: ::c_ulong = 25;
pub const AT_HWCAP2: ::c_ulong = 26;
pub const AT_EXECFN: ::c_ulong = 31;

@ericonr
Copy link
Author

ericonr commented Mar 24, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant