1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-26 13:10:46 +03:00

Silently ignore broken .llvm_addrsig

Fixes https://github.com/rui314/mold/issues/1213
This commit is contained in:
Rui Ueyama 2024-03-04 16:54:52 +09:00
parent 89a4720575
commit 51f871f43b

View File

@ -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;
}