mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-18 17:42:36 +08:00
Sync .note.gnu.property to PT_GNU_PROPERTY
This commit is contained in:
@@ -585,6 +585,7 @@ typedef struct
|
||||
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
||||
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
|
||||
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
|
||||
#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */
|
||||
#define PT_LOSUNW 0x6ffffffa
|
||||
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
||||
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
||||
|
@@ -652,6 +652,18 @@ void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is .note.gnu.property section, then the PT_GNU_PROPERTY
|
||||
segment must be sync'ed with it. */
|
||||
if (sectionName == ".note.gnu.property") {
|
||||
for (auto & phdr : phdrs) {
|
||||
if (rdi(phdr.p_type) == PT_GNU_PROPERTY) {
|
||||
phdr.p_offset = shdr.sh_offset;
|
||||
phdr.p_vaddr = phdr.p_paddr = shdr.sh_addr;
|
||||
phdr.p_filesz = phdr.p_memsz = shdr.sh_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curOff += roundUp(i.second.size(), sectionAlignment);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user