convert EHFrameSection to be managed by TLOF instead of TAI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-02 06:52:36 +00:00
parent 21e1e81aa6
commit 35039ac241
6 changed files with 15 additions and 10 deletions

View File

@ -62,6 +62,11 @@ protected:
/// the section the Language Specific Data Area information is emitted to. /// the section the Language Specific Data Area information is emitted to.
const MCSection *LSDASection; const MCSection *LSDASection;
/// EHFrameSection - If exception handling is supported by the target, this is
/// the section the EH Frame is emitted to.
const MCSection *EHFrameSection;
public: public:
// FIXME: NONPUB. // FIXME: NONPUB.
const MCSection *getOrCreateSection(const char *Name, const MCSection *getOrCreateSection(const char *Name,
@ -84,7 +89,8 @@ public:
const MCSection *getStaticCtorSection() const { return StaticCtorSection; } const MCSection *getStaticCtorSection() const { return StaticCtorSection; }
const MCSection *getStaticDtorSection() const { return StaticDtorSection; } const MCSection *getStaticDtorSection() const { return StaticDtorSection; }
const MCSection *getLSDASection() const { return LSDASection; } const MCSection *getLSDASection() const { return LSDASection; }
const MCSection *getEHFrameSection() const { return EHFrameSection; }
/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
/// decide not to emit the UsedDirective for some symbols in llvm.used. /// decide not to emit the UsedDirective for some symbols in llvm.used.
/// FIXME: REMOVE this (rdar://7071300) /// FIXME: REMOVE this (rdar://7071300)

View File

@ -56,7 +56,7 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality,
TD->getPointerSize() : -TD->getPointerSize(); TD->getPointerSize() : -TD->getPointerSize();
// Begin eh frame section. // Begin eh frame section.
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection()); Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
if (TAI->is_EHSymbolPrivate()) if (TAI->is_EHSymbolPrivate())
O << TAI->getPrivateGlobalPrefix(); O << TAI->getPrivateGlobalPrefix();
@ -150,7 +150,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
const Function *TheFunc = EHFrameInfo.function; const Function *TheFunc = EHFrameInfo.function;
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection()); Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
// Externally visible entry into the functions eh frame info. If the // Externally visible entry into the functions eh frame info. If the
// corresponding function is static, this should not be externally visible. // corresponding function is static, this should not be externally visible.

View File

@ -26,8 +26,6 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
UsedDirective = "\t.no_dead_strip\t"; UsedDirective = "\t.no_dead_strip\t";
SupportsExceptionHandling = true; SupportsExceptionHandling = true;
DwarfEHFrameSection =
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
GlobalEHDirective = "\t.globl\t"; GlobalEHDirective = "\t.globl\t";
SupportsWeakOmittedEHFrame = false; SupportsWeakOmittedEHFrame = false;
} }
@ -64,7 +62,6 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
if (!TM.getSubtargetImpl()->isPPC64()) if (!TM.getSubtargetImpl()->isPPC64())
SupportsExceptionHandling = true; SupportsExceptionHandling = true;
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
} }

View File

@ -96,7 +96,6 @@ TargetAsmInfo::TargetAsmInfo() {
DwarfARangesSection = ".debug_aranges"; DwarfARangesSection = ".debug_aranges";
DwarfRangesSection = ".debug_ranges"; DwarfRangesSection = ".debug_ranges";
DwarfMacroInfoSection = ".debug_macinfo"; DwarfMacroInfoSection = ".debug_macinfo";
DwarfEHFrameSection = ".eh_frame";
AsmTransCBE = 0; AsmTransCBE = 0;
} }

View File

@ -37,6 +37,7 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
StaticCtorSection = 0; StaticCtorSection = 0;
StaticDtorSection = 0; StaticDtorSection = 0;
LSDASection = 0; LSDASection = 0;
EHFrameSection = 0;
} }
TargetLoweringObjectFile::~TargetLoweringObjectFile() { TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@ -311,6 +312,8 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
// adjusted or this should be a data section. // adjusted or this should be a data section.
LSDASection = LSDASection =
getOrCreateSection(".gcc_except_table", false, SectionKind::getReadOnly()); getOrCreateSection(".gcc_except_table", false, SectionKind::getReadOnly());
EHFrameSection =
getOrCreateSection(".eh_frame", false, SectionKind::getDataRel());
} }
@ -548,6 +551,9 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
LSDASection = getOrCreateSection("__DATA,__gcc_except_tab", false, LSDASection = getOrCreateSection("__DATA,__gcc_except_tab", false,
SectionKind::getDataRel()); SectionKind::getDataRel());
EHFrameSection =
getOrCreateSection("__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms"
"+live_support", false, SectionKind::getReadOnly());
} }
const MCSection *TargetLoweringObjectFileMachO:: const MCSection *TargetLoweringObjectFileMachO::

View File

@ -82,8 +82,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
GlobalEHDirective = "\t.globl\t"; GlobalEHDirective = "\t.globl\t";
SupportsWeakOmittedEHFrame = false; SupportsWeakOmittedEHFrame = false;
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection =
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
} }
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) : X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
@ -115,7 +113,6 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
// Exceptions handling // Exceptions handling
SupportsExceptionHandling = true; SupportsExceptionHandling = true;
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
// On Linux we must declare when we can use a non-executable stack. // On Linux we must declare when we can use a non-executable stack.
if (TM.getSubtarget<X86Subtarget>().isLinux()) if (TM.getSubtarget<X86Subtarget>().isLinux())