aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-02-21 11:53:32 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-02-21 11:53:32 +0000
commitb5bd026a756d8650f2a94607c9b1dc34cf1c024a (patch)
tree178d1c6b7d74f4fa683da433083ed48e6ab3b069 /lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
parent8e87e65d28084a5eb0c163256d8473edc2636c5b (diff)
downloadexternal_llvm-b5bd026a756d8650f2a94607c9b1dc34cf1c024a.zip
external_llvm-b5bd026a756d8650f2a94607c9b1dc34cf1c024a.tar.gz
external_llvm-b5bd026a756d8650f2a94607c9b1dc34cf1c024a.tar.bz2
Drop bunch of half-working stuff in the ext_weak linkage support.
Now we're using one gross, but quite robust hack :) (previous ones did not work, for example, when ext_weak symbol was used deep inside constant expression in the initializer). The proper fix of this problem will require some quite huge asmprinter changes and that's why was postponed. This fixes PR3629 by the way :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 12cfda1..ca1d738 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -871,12 +871,6 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size\t" << name << ", " << Size << '\n';
- // If the initializer is a extern weak symbol, remember to emit the weak
- // reference!
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
- if (GV->hasExternalWeakLinkage())
- ExtWeakSymbols.insert(GV);
-
EmitGlobalConstant(C);
}
@@ -907,6 +901,25 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
if (I->hasDLLExportLinkage())
DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),""));
+
+ // If the global is a extern weak symbol, remember to emit the weak
+ // reference!
+ // FIXME: This is rather hacky, since we'll emit references to ALL weak stuff,
+ // not used. But currently it's the only way to deal with extern weak
+ // initializers hidden deep inside constant expressions.
+ if (I->hasExternalWeakLinkage())
+ ExtWeakSymbols.insert(I);
+ }
+
+ for (Module::const_iterator I = M.begin(), E = M.end();
+ I != E; ++I) {
+ // If the global is a extern weak symbol, remember to emit the weak
+ // reference!
+ // FIXME: This is rather hacky, since we'll emit references to ALL weak stuff,
+ // not used. But currently it's the only way to deal with extern weak
+ // initializers hidden deep inside constant expressions.
+ if (I->hasExternalWeakLinkage())
+ ExtWeakSymbols.insert(I);
}
// Output linker support code for dllexported globals