Skip to content

Commit

Permalink
Revert "[ELF] Relax TLSLD error check"
Browse files Browse the repository at this point in the history
This reverts commit 1baac27.

In order to link gcc 7's output, relaxing this error check wasn't
enough as reported on #145.
We need to remove more error checks or keep them as-is.
For now, I'll restore all the error checks, but before making another
release, I may remove all error checks to accept gcc 7's buggy
output files.
  • Loading branch information
rui314 committed Dec 20, 2021
1 parent fb89ce2 commit 2bd3bc6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions elf/arch-x86-64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,9 @@ void InputSection<X86_64>::scan_relocations(Context<X86_64> &ctx) {
case R_X86_64_TLSLD:
if (i + 1 == rels.size())
Fatal(ctx) << *this
<< ": 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;
}
<< ": TLSGD reloc must be followed by PLT32 or GOTPCREL";
if (sym.is_imported)
Fatal(ctx) << *this << ": TLSLD reloc refers external symbol: " << sym;

if (ctx.arg.relax && !ctx.arg.shared)
i++;
Expand Down

0 comments on commit 2bd3bc6

Please sign in to comment.