summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 05:08:13 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 05:08:13 +0000
commit41eb8b47717e1fe1a6d0e99ec1b4e890091f77aa (patch)
tree13443fbd3a1304ce293c9637c200370af2007928 /lib
parent619ea855e72bb67f14ef78d942b84368ca9ab4ae (diff)
downloadllvm-41eb8b47717e1fe1a6d0e99ec1b4e890091f77aa.tar.gz
llvm-41eb8b47717e1fe1a6d0e99ec1b4e890091f77aa.tar.bz2
llvm-41eb8b47717e1fe1a6d0e99ec1b4e890091f77aa.tar.xz
hookize the cygwin ".linkonce" directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCAsmInfo.cpp1
-rw-r--r--lib/MC/MCAsmInfoCOFF.cpp1
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp17
3 files changed, 13 insertions, 6 deletions
diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp
index 4c53d7a284..556b0aa6c6 100644
--- a/lib/MC/MCAsmInfo.cpp
+++ b/lib/MC/MCAsmInfo.cpp
@@ -62,6 +62,7 @@ MCAsmInfo::MCAsmInfo() {
UsedDirective = 0;
WeakRefDirective = 0;
WeakDefDirective = 0;
+ LinkOnceDirective = 0;
// FIXME: These are ELFish - move to ELFMAI.
HiddenDirective = "\t.hidden\t";
ProtectedDirective = "\t.protected\t";
diff --git a/lib/MC/MCAsmInfoCOFF.cpp b/lib/MC/MCAsmInfoCOFF.cpp
index 23b0dd7791..1b27bf026e 100644
--- a/lib/MC/MCAsmInfoCOFF.cpp
+++ b/lib/MC/MCAsmInfoCOFF.cpp
@@ -25,6 +25,7 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() {
HiddenDirective = NULL;
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
WeakRefDirective = "\t.weak\t";
+ LinkOnceDirective = "\t.linkonce same_size\n";
SetDirective = "\t.set\t";
// Set up DWARF directives
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index 358bb70e2c..a095411057 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -727,12 +727,16 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkerPrivateLinkage:
- if (Subtarget->isTargetDarwin()) {
+ if (const char *WeakDef = MAI->getWeakDefDirective()) {
+ // .globl _foo
OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- O << MAI->getWeakDefDirective() << *GVarSym << '\n';
- } else if (Subtarget->isTargetCygMing()) {
+ // .weak_definition _foo
+ O << WeakDef << *GVarSym << '\n';
+ } else if (const char *LinkOnce = MAI->getLinkOnceDirective()) {
+ // .globl _foo
OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- O << "\t.linkonce same_size\n";
+ // .linkonce same_size
+ O << LinkOnce;
} else
O << "\t.weak\t" << *GVarSym << '\n';
break;
@@ -741,7 +745,8 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
- // If external or appending, declare as a global symbol
+ // If external or appending, declare as a global symbol.
+ // .globl _foo
OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
break;
case GlobalValue::PrivateLinkage:
@@ -753,7 +758,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
EmitAlignment(AlignLog, GVar);
O << *GVarSym << ":";
- if (VerboseAsm){
+ if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());