mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Everywhere: Replace ElfW(type)
macro usage with Elf_type
This works around a `clang-format-17` bug which caused certain usages to be misformatted and fail to compile. Fixes #8315
This commit is contained in:
parent
2151e6c8b4
commit
45d81dceed
20 changed files with 129 additions and 127 deletions
|
@ -12,8 +12,8 @@ namespace ELF {
|
|||
bool perform_relative_relocations(FlatPtr base_address)
|
||||
{
|
||||
|
||||
ElfW(Ehdr)* header = (ElfW(Ehdr)*)(base_address);
|
||||
ElfW(Phdr)* pheader = (ElfW(Phdr)*)(base_address + header->e_phoff);
|
||||
Elf_Ehdr* header = (Elf_Ehdr*)(base_address);
|
||||
Elf_Phdr* pheader = (Elf_Phdr*)(base_address + header->e_phoff);
|
||||
FlatPtr dynamic_section_addr = 0;
|
||||
for (size_t i = 0; i < (size_t)header->e_phnum; ++i, ++pheader) {
|
||||
if (pheader->p_type != PT_DYNAMIC)
|
||||
|
@ -30,7 +30,7 @@ bool perform_relative_relocations(FlatPtr base_address)
|
|||
FlatPtr relr_relocation_section_addr = 0;
|
||||
size_t relr_relocation_table_size = 0;
|
||||
bool use_addend = false;
|
||||
auto* dyns = reinterpret_cast<const ElfW(Dyn)*>(dynamic_section_addr);
|
||||
auto* dyns = reinterpret_cast<Elf_Dyn const*>(dynamic_section_addr);
|
||||
for (unsigned i = 0;; ++i) {
|
||||
auto& dyn = dyns[i];
|
||||
if (dyn.d_tag == DT_NULL)
|
||||
|
@ -58,7 +58,7 @@ bool perform_relative_relocations(FlatPtr base_address)
|
|||
|
||||
for (unsigned i = 0; i < relocation_count; ++i) {
|
||||
size_t offset_in_section = i * relocation_entry_size;
|
||||
auto* relocation = (ElfW(Rela)*)(relocation_section_addr + offset_in_section);
|
||||
auto* relocation = (Elf_Rela*)(relocation_section_addr + offset_in_section);
|
||||
VERIFY(ELF64_R_TYPE(relocation->r_info) == R_X86_64_RELATIVE || ELF64_R_TYPE(relocation->r_info) == R_AARCH64_RELATIVE);
|
||||
auto* patch_address = (FlatPtr*)(base_address + relocation->r_offset);
|
||||
FlatPtr relocated_address;
|
||||
|
@ -78,7 +78,7 @@ bool perform_relative_relocations(FlatPtr base_address)
|
|||
__builtin_memcpy(patch_ptr, &relocated_address, sizeof(FlatPtr));
|
||||
};
|
||||
|
||||
auto* entries = reinterpret_cast<ElfW(Relr)*>(relr_relocation_section_addr);
|
||||
auto* entries = reinterpret_cast<Elf_Relr*>(relr_relocation_section_addr);
|
||||
FlatPtr* patch_ptr = nullptr;
|
||||
|
||||
for (unsigned i = 0; i < relr_relocation_table_size / sizeof(FlatPtr); ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue