summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-09-29 15:26:12 +0000
committerFangrui Song <maskray@google.com>2019-11-08 14:47:48 -0800
commit8f089f2099d39021bbfb76a2cd575612382a7cf6 (patch)
tree52aaa06536fd0e4b82d37f2684b7f422750144df /llvm/lib/MC/ELFObjectWriter.cpp
parent3a7a22445e806c08f80cf6d83d1760f7ff732ed0 (diff)
downloadbcm5719-llvm-8f089f2099d39021bbfb76a2cd575612382a7cf6.tar.gz
bcm5719-llvm-8f089f2099d39021bbfb76a2cd575612382a7cf6.zip
[MC] Emit unused undefined symbol even if its binding is not set
Recommit r373168, which was reverted by r373242. This actually exposed a boringssl bug which has been fixed for more than one month. For the following two cases, we currently suppress the symbols. This patch emits them (compatible with GNU as). * `test2_a = undef`: if `undef` is otherwise unused. * `.hidden hidden`: if `hidden` is unused. This is the main point of the patch, because omitting the symbol would cause a linker semantic difference. It causes a behavior change that is not compatible with GNU as: .weakref foo1, bar1 When neither foo1 nor bar1 is used, we now emit bar1, which is arguably more consistent. Another change is that we will emit .TOC. for .TOC.@tocbase . For this directive, suppressing .TOC. can be seen as a size optimization, but we choose to drop it for simplicity and consistency.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 6f160e491ce..f8e93889344 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -615,9 +615,6 @@ bool ELFWriter::isInSymtab(const MCAsmLayout &Layout, const MCSymbolELF &Symbol,
return false;
}
- if (Symbol.isUndefined() && !Symbol.isBindingSet())
- return false;
-
if (Symbol.isTemporary())
return false;
OpenPOWER on IntegriCloud