Make sure to use SwitchSection to switch sections so that we don't accidentally emit

functions into the .const section.  Whoops.

llvm-svn: 24363
This commit is contained in:
Chris Lattner 2005-11-15 01:45:01 +00:00
parent f7a530046f
commit bbed9bff31

View File

@ -437,7 +437,7 @@ void DarwinAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
if (CP.empty()) return; if (CP.empty()) return;
for (unsigned i = 0, e = CP.size(); i != e; ++i) { for (unsigned i = 0, e = CP.size(); i != e; ++i) {
O << "\t.const\n"; SwitchSection(".const", 0);
// FIXME: force doubles to be naturally aligned. We should handle this // FIXME: force doubles to be naturally aligned. We should handle this
// more correctly in the future. // more correctly in the future.
if (Type::DoubleTy == CP[i]->getType()) if (Type::DoubleTy == CP[i]->getType())
@ -487,6 +487,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
} else { } else {
switch (I->getLinkage()) { switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage: case GlobalValue::LinkOnceLinkage:
SwitchSection("", 0);
O << ".section __TEXT,__textcoal_nt,coalesced,no_toc\n" O << ".section __TEXT,__textcoal_nt,coalesced,no_toc\n"
<< ".weak_definition " << name << '\n' << ".weak_definition " << name << '\n'
<< ".private_extern " << name << '\n' << ".private_extern " << name << '\n'
@ -649,7 +650,7 @@ void AIXAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
if (CP.empty()) return; if (CP.empty()) return;
for (unsigned i = 0, e = CP.size(); i != e; ++i) { for (unsigned i = 0, e = CP.size(); i != e; ++i) {
O << "\t.const\n"; SwitchSection(".const", 0);
O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType()) O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
<< "\n"; << "\n";
O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t;" O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t;"