diff options
author | 2024-04-04 01:19:37 +0000 | |
---|---|---|
committer | 2024-04-04 18:15:27 +0000 | |
commit | 97cf36494e4f63d8fe45f0ad21cb9f996c662eb2 (patch) | |
tree | 86f756148354791d4ff1b04a36caef53d7927d03 | |
parent | 17f80ec0455ed44b0e6f03c729f5d29bcf27a7c7 (diff) |
Simplify and explain the ELF_ST_*() macros.
Change-Id: Iccf9b8d052e07114312573f51d8973b9d76d9179
-rw-r--r-- | libelffile/elf/elf_utils.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libelffile/elf/elf_utils.h b/libelffile/elf/elf_utils.h index dc966440b2..0660e515da 100644 --- a/libelffile/elf/elf_utils.h +++ b/libelffile/elf/elf_utils.h @@ -57,8 +57,13 @@ struct ElfTypes64 { using Dyn = Elf64_Dyn; }; -#define ELF_ST_BIND(x) ((x) >> 4) -#define ELF_ST_TYPE(x) ((x) & 0xf) +// Only bionic has ELF class generic macros; glibc/musl require you to specify +// ELF32 or ELF64, even though they're the same, and that makes call sites look +// misleadingly class-specific. +#ifndef __BIONIC__ +#define ELF_ST_BIND(x) ELF64_ST_BIND(x) +#define ELF_ST_TYPE(x) ELF64_ST_TYPE(x) +#endif // Missing from musl (https://www.openwall.com/lists/musl/2024/03/21/10). #ifndef EF_RISCV_RVC |