diff options
Diffstat (limited to 'libc/startup/linux/x86_64/start.cpp')
-rw-r--r-- | libc/startup/linux/x86_64/start.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libc/startup/linux/x86_64/start.cpp b/libc/startup/linux/x86_64/start.cpp index 496105d..c98f58a 100644 --- a/libc/startup/linux/x86_64/start.cpp +++ b/libc/startup/linux/x86_64/start.cpp @@ -144,12 +144,7 @@ static void call_fini_array_callbacks() { } // namespace LIBC_NAMESPACE using LIBC_NAMESPACE::app; - -// TODO: Would be nice to use the aux entry structure from elf.h when available. -struct AuxEntry { - uint64_t type; - uint64_t value; -}; +using LIBC_NAMESPACE::AuxEntry; extern "C" void _start() { // This TU is compiled with -fno-omit-frame-pointer. Hence, the previous value @@ -193,9 +188,9 @@ extern "C" void _start() { // denoted by an AT_NULL entry. Elf64_Phdr *program_hdr_table = nullptr; uintptr_t program_hdr_count = 0; - for (AuxEntry *aux_entry = reinterpret_cast<AuxEntry *>(env_end_marker + 1); - aux_entry->type != AT_NULL; ++aux_entry) { - switch (aux_entry->type) { + app.auxv_ptr = reinterpret_cast<AuxEntry *>(env_end_marker + 1); + for (auto *aux_entry = app.auxv_ptr; aux_entry->id != AT_NULL; ++aux_entry) { + switch (aux_entry->id) { case AT_PHDR: program_hdr_table = reinterpret_cast<Elf64_Phdr *>(aux_entry->value); break; |