[llvm] r225983 - Handle a symbol being undefined.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 14 05:53:51 PST 2015
Author: rafael
Date: Wed Jan 14 07:53:50 2015
New Revision: 225983
URL: http://llvm.org/viewvc/llvm-project?rev=225983&view=rev
Log:
Handle a symbol being undefined.
This can happen if:
* It is present in a comdat in one file.
* It is not present in the comdat of the file that is kept.
* Is is not used.
This should fix the LTO boostrap.
Thanks to Takumi NAKAMURA for setting up the bot!
Modified:
llvm/trunk/test/tools/gold/Inputs/comdat.ll
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/test/tools/gold/Inputs/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/Inputs/comdat.ll?rev=225983&r1=225982&r2=225983&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/Inputs/comdat.ll (original)
+++ llvm/trunk/test/tools/gold/Inputs/comdat.ll Wed Jan 14 07:53:50 2015
@@ -1,4 +1,9 @@
$c2 = comdat any
+$c1 = comdat any
+
+; This is only present in this file. The linker will keep $c1 from the first
+; file and this will be undefined.
+ at will_be_undefined = global i32 1, comdat($c1)
@v1 = weak_odr global i32 41, comdat($c2)
define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=225983&r1=225982&r2=225983&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Jan 14 07:53:50 2015
@@ -629,10 +629,14 @@ getModuleForFile(LLVMContext &Context, c
case LDPR_RESOLVED_IR:
case LDPR_RESOLVED_EXEC:
case LDPR_RESOLVED_DYN:
- case LDPR_UNDEF:
assert(GV->isDeclarationForLinker());
break;
+ case LDPR_UNDEF:
+ assert(GV->hasComdat());
+ Drop.insert(GV);
+ break;
+
case LDPR_PREVAILING_DEF_IRONLY: {
keepGlobalValue(*GV, KeptAliases);
if (!Used.count(GV)) {
More information about the llvm-commits
mailing list