aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-12-01 20:47:11 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-12-01 20:47:11 +0000
commit8752ce61e1ba3973e0082085c1c3c9b8069ea2b7 (patch)
tree66e214ce9e56dbe86fab449e8b9ecaea6111f1c9 /lib
parentd154b57ab412b325f6627a2f691de8cd68ba5d18 (diff)
downloadexternal_llvm-8752ce61e1ba3973e0082085c1c3c9b8069ea2b7.zip
external_llvm-8752ce61e1ba3973e0082085c1c3c9b8069ea2b7.tar.gz
external_llvm-8752ce61e1ba3973e0082085c1c3c9b8069ea2b7.tar.bz2
Add weak reference directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp12
-rw-r--r--lib/Target/PowerPC/PPCTargetAsmInfo.cpp1
-rw-r--r--lib/Target/TargetAsmInfo.cpp1
-rw-r--r--lib/Target/X86/X86AsmPrinter.cpp8
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp2
5 files changed, 13 insertions, 11 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 1b9e94a..abbcc57 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -647,11 +647,13 @@ bool DarwinAsmPrinter::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 << "\t.weak_reference " << *i << "\n";
+ if (TAI->getWeakRefDirective()) {
+ 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";
+ }
}
bool isPPC64 = TD->getPointerSizeInBits() == 64;
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index f8848f5..1e38009 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -33,6 +33,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) {
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
UsedDirective = "\t.no_dead_strip\t";
+ WeakRefDirective = "\t.weak_reference\t";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 2b4f2f7..8b818fb 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -61,6 +61,7 @@ TargetAsmInfo::TargetAsmInfo() :
COMMDirectiveTakesAlignment(true),
HasDotTypeDotSizeDirective(true),
UsedDirective(0),
+ WeakRefDirective(0),
HasLEB128(false),
HasDotLoc(false),
HasDotFile(false),
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index b92a087..7226975 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -278,16 +278,12 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\t.ascii \" -export:" << *i << "\"\n";
}
- if (!Subtarget->isTargetCygwin()) {
- // There is no external weak linkage on Mingw32 platform.
- // Defaulting to external
+ if (TAI->getWeakRefDirective()) {
if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
SwitchToDataSection("");
-
for (std::set<std::string>::iterator i = ExtWeakSymbols.begin(),
e = ExtWeakSymbols.end(); i != e; ++i) {
- O << (Subtarget->isTargetDarwin() ? "\t.weak_reference" : "\t.weak")
- << " " << *i << "\n";
+ O << TAI->getWeakRefDirective() << *i << "\n";
}
}
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index 4d44b7d..ed9f1ac 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -62,6 +62,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";
UsedDirective = "\t.no_dead_strip\t";
+ WeakRefDirective = "\t.weak_reference\t";
NeedsSet = true;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
@@ -86,6 +87,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
// HasDotFile - True if target asm supports .file directives.
// bool HasDotFile; // Defaults to false.
PrivateGlobalPrefix = "."; // Prefix for private global symbols
+ WeakRefDirective = "\t.weak\t";
DwarfRequiresFrameSection = false;
DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";