From 5874a28ac56dc50cee72f30b729cbc03b35f3db9 Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Mon, 22 Jul 2019 17:48:53 +0000 Subject: Revert "Reland [ELF] Loose a condition for relocation with a symbol" This reverts commit r366686 as it appears to be causing buildbot failures on sanitizer-x86_64-linux-android and sanitizer-x86_64-linux. llvm-svn: 366708 --- llvm/lib/MC/ELFObjectWriter.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/MC/ELFObjectWriter.cpp') diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index e20af8de0c3..2c68723a12f 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1396,6 +1396,11 @@ 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 -- cgit v1.2.3