aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2006-12-06 13:35:10 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2006-12-06 13:35:10 +0000
commit392b1b2ef3ace82b5104ba4c9280fc7957c669d4 (patch)
treead1b4032e67ac0c31f57b2423a116a19b8238979 /lib
parent2792cfb82da52c4b36d72b837ee4865e56dab3c7 (diff)
print weak references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMAsmPrinter.cpp14
-rw-r--r--lib/Target/ARM/ARMTargetAsmInfo.cpp1
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp
index 093dd6db17..5eadee20db 100644
--- a/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -63,6 +63,8 @@ namespace {
: AsmPrinter(O, TM, T) {
}
+ std::set<std::string> ExtWeakSymbols;
+
/// We name each basic block in a Function with a unique number, so
/// that we can consistently refer to them later. This is cleared
/// at the beginning of each call to runOnMachineFunction().
@@ -127,7 +129,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
break;
case Function::WeakLinkage:
case Function::LinkOnceLinkage:
- O << "\t.weak\t" << CurrentFnName << "\n";
+ O << TAI->getWeakRefDirective() << CurrentFnName << "\n";
break;
}
EmitAlignment(2, F);
@@ -244,6 +246,9 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
GlobalValue *GV = MO.getGlobal();
std::string Name = Mang->getValueName(GV);
O << Name;
+ if (GV->hasExternalWeakLinkage()) {
+ ExtWeakSymbols.insert(Name);
+ }
}
break;
case MachineOperand::MO_ExternalSymbol:
@@ -325,6 +330,13 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
}
}
+ if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
+ SwitchToDataSection("");
+ for (std::set<std::string>::iterator i = ExtWeakSymbols.begin(),
+ e = ExtWeakSymbols.end(); i != e; ++i) {
+ O << TAI->getWeakRefDirective() << *i << "\n";
+ }
+
AsmPrinter::doFinalization(M);
return false; // success
}
diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp
index 90db466676..510c0092ff 100644
--- a/lib/Target/ARM/ARMTargetAsmInfo.cpp
+++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp
@@ -23,4 +23,5 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
CommentString = "@";
ConstantPoolSection = "\t.text\n";
AlignmentIsInBytes = false;
+ WeakRefDirective = "\t.weak\t";
}