1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-13 09:39:13 +03:00

[ELF] Relax TLSLD error check

This is a workaround for https://github.com/rui314/mold/issues/145
This commit is contained in:
Rui Ueyama 2021-12-17 14:35:41 +09:00
parent a9f9163d2c
commit 1baac27e8c

View File

@ -629,9 +629,15 @@ void InputSection<X86_64>::scan_relocations(Context<X86_64> &ctx) {
case R_X86_64_TLSLD:
if (i + 1 == rels.size())
Fatal(ctx) << *this
<< ": TLSGD reloc must be followed by PLT32 or GOTPCREL";
if (sym.is_imported)
Fatal(ctx) << *this << ": TLSLD reloc refers external symbol: " << sym;
<< ": TLSLD reloc must be followed by PLT32 or GOTPCREL";
if (sym.is_imported) {
// This should be a fatal error as well, but it looks like GCC 7
// wrongly creates such relocations against STB_GNU_UNIQUE symbols.
// Other linkers don't have this error check. So, for bug-compatibility,
// we only warn about it and create a (possibly corrupted) output file.
Warn(ctx) << *this << ": TLSLD reloc refers external symbol: " << sym;
}
if (ctx.arg.relax && !ctx.arg.shared)
i++;