summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LTO.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-03-29 23:57:22 +0000
committerDavide Italiano <davide@freebsd.org>2016-03-29 23:57:22 +0000
commit49fe4eda4c06b1a29eb9a39bc60b89f5f2f6e97d (patch)
tree7c7c237ab9bfbbbd3c5112e7fd82dc19ac2e5fce /lld/ELF/LTO.cpp
parentb1631d9161ced5a90ec345aaa809ce971a77cf55 (diff)
downloadbcm5719-llvm-49fe4eda4c06b1a29eb9a39bc60b89f5f2f6e97d.tar.gz
bcm5719-llvm-49fe4eda4c06b1a29eb9a39bc60b89f5f2f6e97d.zip
[LTO] Add a comment to explain how we handle @llvm.used.
Requested by: Rui Ueyama. llvm-svn: 264809
Diffstat (limited to 'lld/ELF/LTO.cpp')
-rw-r--r--lld/ELF/LTO.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 63fb6e3a3a5..b1d5d60b878 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -78,6 +78,10 @@ void BitcodeCompiler::add(BitcodeFile &F) {
ArrayRef<SymbolBody *> Bodies = F.getSymbols();
Module &M = Obj->getModule();
+
+ // If a symbol appears in @llvm.used, the linker is required
+ // to treat the symbol as there is a reference to the symbol
+ // that it cannot see. Therefore, we can't internalize.
SmallPtrSet<GlobalValue *, 8> Used;
collectUsedGlobalVariables(M, Used, /* CompilerUsed */ false);
OpenPOWER on IntegriCloud