Skip to content

Commit

Permalink
Merge pull request #384 from lief-project/revert-382-always-parse-sec…
Browse files Browse the repository at this point in the history
…tion-relocs

Revert "Binaries generated with --emit-relocs have dynamic and section relocations"
  • Loading branch information
romainthomas committed Mar 14, 2020
2 parents f210e6b + e39f939 commit 1014ba0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/ELF/Parser.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -430,25 +430,26 @@ void Parser::parse_binary(void) {
}

// Try to parse using sections
if (this->binary_->relocations_.size() == 0) {
for (const Section& section : this->binary_->sections()) {

for (const Section& section : this->binary_->sections()) {
try {
if (section.type() == ELF_SECTION_TYPES::SHT_REL) {

try {
if (section.type() == ELF_SECTION_TYPES::SHT_REL) {
this->parse_section_relocations<ELF_T, typename ELF_T::Elf_Rel>(section);
}
else if (section.type() == ELF_SECTION_TYPES::SHT_RELA) {
this->parse_section_relocations<ELF_T, typename ELF_T::Elf_Rela>(section);
}
this->parse_section_relocations<ELF_T, typename ELF_T::Elf_Rel>(section);
}
else if (section.type() == ELF_SECTION_TYPES::SHT_RELA) {
this->parse_section_relocations<ELF_T, typename ELF_T::Elf_Rela>(section);
}

} catch (const exception& e) {
LOG(WARNING) << "Unable to parse relocations from section '"
<< section.name() << "'"
<< " (" << e.what() << ")";
} catch (const exception& e) {
LOG(WARNING) << "Unable to parse relocations from section '"
<< section.name() << "'"
<< " (" << e.what() << ")";
}
}
}


this->link_symbol_version();
this->parse_overlay();
}
Expand Down

0 comments on commit 1014ba0

Please sign in to comment.