Put cstrings in .cstring section when compiling for Mac OS X.

llvm-svn: 31203
This commit is contained in:
Evan Cheng 2006-10-26 19:18:18 +00:00
parent 684ba840eb
commit 392f645783
2 changed files with 10 additions and 1 deletions

View File

@ -204,9 +204,17 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
// If external or appending, declare as a global symbol
O << "\t.globl " << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
case GlobalValue::InternalLinkage: {
if (TAI->getCStringSection()) {
const ConstantArray *CVA = dyn_cast<ConstantArray>(C);
if (CVA && CVA->isCString()) {
SwitchToDataSection(TAI->getCStringSection(), I);
break;
}
}
SwitchToDataSection(TAI->getDataSection(), I);
break;
}
default:
assert(0 && "Unknown linkage type!");
}

View File

@ -32,6 +32,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
ConstantPoolSection = "\t.const\n";
JumpTableDataSection = "\t.const\n";
CStringSection = "\t.cstring";
FourByteConstantSection = "\t.literal4\n";
EightByteConstantSection = "\t.literal8\n";
if (Subtarget->is64Bit())