aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp35
-rw-r--r--lib/MC/MCAsmInfoCOFF.cpp2
2 files changed, 5 insertions, 32 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index bb90356625..50eff9cbc6 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -169,7 +169,9 @@ void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) {
// FIXME: linkonce should be a section attribute, handled by COFF Section
// assignment.
// http://sourceware.org/binutils/docs-2.20/as/Linkonce.html#Linkonce
- // .linkonce same_size
+ // .linkonce discard
+ // FIXME: It would be nice to use .linkonce samesize for non-common
+ // globals.
O << LinkOnce;
} else {
// .weak _foo
@@ -300,38 +302,9 @@ void AsmPrinter::EmitFunctionHeader() {
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
printVisibility(CurrentFnSym, F->getVisibility());
- switch (F->getLinkage()) {
- default: llvm_unreachable("Unknown linkage type!");
- case Function::InternalLinkage: // Symbols default to internal.
- case Function::PrivateLinkage:
- break;
- case Function::DLLExportLinkage:
- case Function::ExternalLinkage:
- OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global);
- break;
- case Function::LinkerPrivateLinkage:
- case Function::LinkOnceAnyLinkage:
- case Function::LinkOnceODRLinkage:
- case Function::WeakAnyLinkage:
- case Function::WeakODRLinkage:
- if (MAI->getWeakDefDirective() != 0) {
- OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global);
- O << MAI->getWeakDefDirective() << *CurrentFnSym << '\n';
- } else if (MAI->getLinkOnceDirective() != 0) {
- OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global);
- // FIXME: linkonce should be a section attribute, handled by COFF Section
- // assignment.
- // http://sourceware.org/binutils/docs-2.20/as/Linkonce.html#Linkonce
- O << "\t.linkonce discard\n";
- } else {
- O << "\t.weak\t" << *CurrentFnSym << '\n';
- }
- break;
- }
-
+ EmitLinkage(F->getLinkage(), CurrentFnSym);
EmitAlignment(MF->getAlignment(), F);
-
if (MAI->hasDotTypeDotSizeDirective())
OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
diff --git a/lib/MC/MCAsmInfoCOFF.cpp b/lib/MC/MCAsmInfoCOFF.cpp
index ace7ba1e79..9130493de2 100644
--- a/lib/MC/MCAsmInfoCOFF.cpp
+++ b/lib/MC/MCAsmInfoCOFF.cpp
@@ -24,7 +24,7 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() {
HasSingleParameterDotFile = false;
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
WeakRefDirective = "\t.weak\t";
- LinkOnceDirective = "\t.linkonce same_size\n";
+ LinkOnceDirective = "\t.linkonce discard\n";
// Doesn't support visibility:
HiddenVisibilityAttr = ProtectedVisibilityAttr = MCSA_Invalid;