Adding linkonce linkage codegeneration support for mingw32\cygwin

targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2006-10-17 20:29:49 +00:00
parent 278dbaa17f
commit b7188b1684
2 changed files with 26 additions and 1 deletions

View File

@ -89,8 +89,20 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
EmitAlignment(4, F); // FIXME: This should be parameterized somewhere.
O << "\t.globl\t" << CurrentFnName << "\n";
break;
case Function::WeakLinkage:
case Function::LinkOnceLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl\t" << CurrentFnName << "\n";
O << "\t.weak_definition\t" << CurrentFnName << "\n";
} else if (Subtarget->isTargetCygwin()) {
EmitAlignment(4, F); // FIXME: This should be parameterized somewhere.
O << "\t.linkonce discard\n";
O << "\t.globl " << CurrentFnName << "\n";
} else {
EmitAlignment(4, F); // FIXME: This should be parameterized somewhere.
O << "\t.weak " << CurrentFnName << "\n";
}
break;
case Function::WeakLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl\t" << CurrentFnName << "\n";
O << "\t.weak_definition\t" << CurrentFnName << "\n";

View File

@ -174,6 +174,19 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl " << name << "\n"
<< "\t.weak_definition " << name << "\n";
SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
} else if (Subtarget->isTargetCygwin()) {
O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\"\n"
<< "\t.globl " << name << "\n"
<< "\t.linkonce same_size\n";
} else {
O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n"
<< "\t.weak " << name << "\n";
}
break;
case GlobalValue::WeakLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl " << name << "\n"