[lld] r264809 - [LTO] Add a comment to explain how we handle @llvm.used.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 16:57:22 PDT 2016


Author: davide
Date: Tue Mar 29 18:57:22 2016
New Revision: 264809

URL: http://llvm.org/viewvc/llvm-project?rev=264809&view=rev
Log:
[LTO] Add a comment to explain how we handle @llvm.used.

Requested by: Rui Ueyama.

Modified:
    lld/trunk/ELF/LTO.cpp

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=264809&r1=264808&r2=264809&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Tue Mar 29 18:57:22 2016
@@ -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);
 




More information about the llvm-commits mailing list