aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-26 23:51:52 +0000
committerChris Lattner <sabre@nondot.org>2010-01-26 23:51:52 +0000
commit111a3193b5e25f8765221f2e94fba888155fe4eb (patch)
tree1d07d95d50869d19c17aa33be0905e1ce772554e /lib/CodeGen/AsmPrinter
parenta3e8883d710c435d640d65e52f0c6dcce21cad5b (diff)
downloadexternal_llvm-111a3193b5e25f8765221f2e94fba888155fe4eb.zip
external_llvm-111a3193b5e25f8765221f2e94fba888155fe4eb.tar.gz
external_llvm-111a3193b5e25f8765221f2e94fba888155fe4eb.tar.bz2
use EmitLinkage for functions as well as globals. One output
change is that we now use ".linkonce discard" for global variables instead of ".linkonce samesize". These should be the same, just less strict. If anyone is interested in mcizing MCSection for COFF targets, this should be easy to fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp35
1 files changed, 4 insertions, 31 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index bb90356..50eff9c 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);