Bug 771569 - Move elfhack sections before .rel{,a}.dyn to work around glibc 2.16 bug. r=nfroyd

This commit is contained in:
Mike Hommey 2012-07-09 15:47:24 +02:00
parent d5d4583352
commit 9d8fb12142
2 changed files with 18 additions and 1 deletions

View File

@ -442,7 +442,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
relhack_entry.r_offset = relhack_entry.r_info = 0;
relhack->push_back(relhack_entry);
relhackcode->insertAfter(section);
relhackcode->insertBefore(section);
relhack->insertAfter(relhackcode);
unsigned int old_end = section->getOffset() + section->getSize();

View File

@ -360,6 +360,23 @@ public:
markDirty();
}
void insertBefore(ElfSection *section, bool dirty = true) {
if (previous != NULL)
previous->next = next;
if (next != NULL)
next->previous = previous;
next = section;
if (section != NULL) {
previous = section->previous;
section->previous = this;
} else
previous = NULL;
if (previous != NULL)
previous->next = this;
if (dirty)
markDirty();
}
void markDirty() {
if (link != NULL)
shdr.sh_link = -1;