Skip to content

Commit

Permalink
Silently ignore broken .llvm_addrsig
Browse files Browse the repository at this point in the history
Fixes #1213
  • Loading branch information
rui314 committed Mar 4, 2024
1 parent 89a4720 commit 51f871f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions elf/input-files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,11 @@ void ObjectFile<E>::initialize_sections(Context<E> &ctx) {

// Save .llvm_addrsig for --icf=safe.
if (shdr.sh_type == SHT_LLVM_ADDRSIG && !ctx.arg.relocatable) {
if (shdr.sh_link != 0) {
// sh_link should be the index of the symbol table section.
// Tools that mutates the symbol table, such as objcopy or `ld -r`
// tend to not preserve sh_link, so we ignore such section.
if (shdr.sh_link != 0)
llvm_addrsig = std::move(this->sections[i]);
} else {
Warn(ctx) << *this << ": ignoring .llvm_addrsig section without"
<< " sh_link; was the file processed by strip or objcopy -r?";
}
continue;
}

Expand Down

0 comments on commit 51f871f

Please sign in to comment.