Use SwitchSection in MipsAsmPrinter::EmitStartOfAsmFile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-01-27 01:33:33 +00:00
parent 1d90318373
commit ad2b41fb75

View File

@@ -34,8 +34,10 @@
#include "llvm/IR/Instructions.h" #include "llvm/IR/Instructions.h"
#include "llvm/IR/Mangler.h" #include "llvm/IR/Mangler.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ELF.h" #include "llvm/Support/ELF.h"
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
@@ -606,8 +608,6 @@ printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
} }
void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) { void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
// FIXME: Use SwitchSection.
// TODO: Need to add -mabicalls and -mno-abicalls flags. // TODO: Need to add -mabicalls and -mno-abicalls flags.
// Currently we assume that -mabicalls is the default. // Currently we assume that -mabicalls is the default.
getTargetStreamer().emitDirectiveAbiCalls(); getTargetStreamer().emitDirectiveAbiCalls();
@@ -616,24 +616,25 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
getTargetStreamer().emitDirectiveOptionPic0(); getTargetStreamer().emitDirectiveOptionPic0();
// Tell the assembler which ABI we are using // Tell the assembler which ABI we are using
if (OutStreamer.hasRawTextSupport()) std::string SectionName = std::string(".mdebug.") + getCurrentABIString();
OutStreamer.EmitRawText("\t.section .mdebug." + OutStreamer.SwitchSection(OutContext.getELFSection(
Twine(getCurrentABIString())); SectionName, ELF::SHT_PROGBITS, 0, SectionKind::getDataRel()));
// TODO: handle O64 ABI // TODO: handle O64 ABI
if (OutStreamer.hasRawTextSupport()) {
if (Subtarget->isABI_EABI()) { if (Subtarget->isABI_EABI()) {
if (Subtarget->isGP32bit()) if (Subtarget->isGP32bit())
OutStreamer.EmitRawText(StringRef("\t.section .gcc_compiled_long32")); OutStreamer.SwitchSection(
else OutContext.getELFSection(".gcc_compiled_long32", ELF::SHT_PROGBITS, 0,
OutStreamer.EmitRawText(StringRef("\t.section .gcc_compiled_long64")); SectionKind::getDataRel()));
} else
OutStreamer.SwitchSection(
OutContext.getELFSection(".gcc_compiled_long64", ELF::SHT_PROGBITS, 0,
SectionKind::getDataRel()));
} }
// return to previous section // return to the text section
if (OutStreamer.hasRawTextSupport()) OutStreamer.SwitchSection(OutContext.getObjectFileInfo()->getTextSection());
OutStreamer.EmitRawText(StringRef("\t.previous"));
} }
void MipsAsmPrinter::EmitEndOfAsmFile(Module &M) { void MipsAsmPrinter::EmitEndOfAsmFile(Module &M) {