mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibELF: Relax restriction on allowed values of EI_OSABI to allow GNU
This check is here to make sure we only try to load serenity binaries. However, with -fprofile-instr-generate -fcoverage-mapping, clang sets the EI_OSABI field to 3, for GNU. The instrumentation uses a lot of retained COMDAT sections for coverage instrumentation that get the SHF_GNU_RETAINED section header flag set on them, forcing llvm to set the ABI to GNU.
This commit is contained in:
parent
1a8b5ef80a
commit
435a263998
1 changed files with 3 additions and 2 deletions
|
@ -46,9 +46,10 @@ bool validate_elf_header(ElfW(Ehdr) const& elf_header, size_t file_size, bool ve
|
|||
return false;
|
||||
}
|
||||
|
||||
if (ELFOSABI_SYSV != elf_header.e_ident[EI_OSABI]) {
|
||||
// NOTE: With Clang, -fprofile-instr-generate -fcoverage-mapping sets our ELF ABI Version to 3 b/c of SHF_GNU_RETAIN
|
||||
if (ELFOSABI_SYSV != elf_header.e_ident[EI_OSABI] && ELFOSABI_LINUX != elf_header.e_ident[EI_OSABI]) {
|
||||
if (verbose)
|
||||
dbgln("File has unknown OS ABI ({}), expected SYSV(0)!", elf_header.e_ident[EI_OSABI]);
|
||||
dbgln("File has unknown OS ABI ({}), expected SYSV(0) or GNU/Linux(3)!", elf_header.e_ident[EI_OSABI]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue