diff options
author | Fangrui Song <i@maskray.me> | 2020-08-02 18:05:17 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-08-02 18:05:17 -0700 |
commit | b497665d98ad5026b1d3d67d5793a28fefe27bea (patch) | |
tree | 7876a091f74293a518f3c427660e0780896e738f /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 4ffa6a27aca17fe88fa6bdd605b198df6632a570 (diff) | |
download | llvm-b497665d98ad5026b1d3d67d5793a28fefe27bea.zip llvm-b497665d98ad5026b1d3d67d5793a28fefe27bea.tar.gz llvm-b497665d98ad5026b1d3d67d5793a28fefe27bea.tar.bz2 |
Reland D64327 [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets
This drops a GNU gold workaround and reverts the revert commit rL366708.
Before binutils 2.34, gold -O2 and above did not correctly handle R_386_GOTOFF to
SHF_MERGE|SHF_STRINGS sections: https://sourceware.org/bugzilla/show_bug.cgi?id=16794
From the original review:
... it reduced the size of a big ARM-32 debug image by 33%. It contained ~68M
of relocations symbols out of total ~71M symbols (96% of symbols table was
generated for relocations with symbol).
-Wl,-O2 (and -Wl,-O3) is so rare that we should just lower the
optimization level for LLVM_LINKER_IS_GOLD rather than pessimizing all users.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 1ca9d0f..5a5692c 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1389,11 +1389,6 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm, if (Flags & ELF::SHF_MERGE) { if (C != 0) return true; - - // It looks like gold has a bug (http://sourceware.org/PR16794) and can - // only handle section relocations to mergeable sections if using RELA. - if (!hasRelocationAddend()) - return true; } // Most TLS relocations use a got, so they need the symbol. Even those that |