convert EHFrameSection to be managed by TLOF instead of TAI.
authorChris Lattner <sabre@nondot.org>
Sun, 2 Aug 2009 06:52:36 +0000 (06:52 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 Aug 2009 06:52:36 +0000 (06:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77888 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetLoweringObjectFile.h
lib/CodeGen/AsmPrinter/DwarfException.cpp
lib/Target/PowerPC/PPCTargetAsmInfo.cpp
lib/Target/TargetAsmInfo.cpp
lib/Target/TargetLoweringObjectFile.cpp
lib/Target/X86/X86TargetAsmInfo.cpp

index 377b9eeae41e226446ef4143bfdd4ae905a8cda8..b4d9b59035fbac0199c99804215a50d445fde17c 100644 (file)
@@ -62,6 +62,11 @@ protected:
   /// the section the Language Specific Data Area information is emitted to.
   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:
   // FIXME: NONPUB.
   const MCSection *getOrCreateSection(const char *Name,
@@ -84,7 +89,8 @@ public:
   const MCSection *getStaticCtorSection() const { return StaticCtorSection; }
   const MCSection *getStaticDtorSection() const { return StaticDtorSection; }
   const MCSection *getLSDASection() const { return LSDASection; }
-  
+  const MCSection *getEHFrameSection() const { return EHFrameSection; }
+
   /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
   /// decide not to emit the UsedDirective for some symbols in llvm.used.
   /// FIXME: REMOVE this (rdar://7071300)
index aa52d87f278e179e2a2d32ea8e1aafdc044dd31a..fec1ad7557377b9e06408aae842bbf5e795db7b3 100644 (file)
@@ -56,7 +56,7 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality,
     TD->getPointerSize() : -TD->getPointerSize();
 
   // Begin eh frame section.
-  Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
+  Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
 
   if (TAI->is_EHSymbolPrivate())
     O << TAI->getPrivateGlobalPrefix();
@@ -150,7 +150,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
 
   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
   // corresponding function is static, this should not be externally visible.
index 0696a9016351658366c33a67cb2f3d7680f6998d..e8b1824c3ed2d947474759053a6bdaab9d868e0c 100644 (file)
@@ -26,8 +26,6 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
   UsedDirective = "\t.no_dead_strip\t";
   SupportsExceptionHandling = true;
   
-  DwarfEHFrameSection =
-   ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
   GlobalEHDirective = "\t.globl\t";
   SupportsWeakOmittedEHFrame = false;
 }
@@ -64,7 +62,6 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
   if (!TM.getSubtargetImpl()->isPPC64())
     SupportsExceptionHandling = true;
   AbsoluteEHSectionOffsets = false;
-  DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
 }
 
 
index a4143ce11cd3c4e6d31394117f8946fb77c904bc..7da3715d2666e3971b9ade7228b29df677d9a836 100644 (file)
@@ -96,7 +96,6 @@ TargetAsmInfo::TargetAsmInfo() {
   DwarfARangesSection = ".debug_aranges";
   DwarfRangesSection = ".debug_ranges";
   DwarfMacroInfoSection = ".debug_macinfo";
-  DwarfEHFrameSection = ".eh_frame";
   AsmTransCBE = 0;
 }
 
index d04e5c0cd609a5c1b7df984a69e4df412a4240e2..38ae71e67d6549226e95ab0aefd4a33abb82dca0 100644 (file)
@@ -37,6 +37,7 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
   StaticCtorSection = 0;
   StaticDtorSection = 0;
   LSDASection = 0;
+  EHFrameSection = 0;
 }
 
 TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -311,6 +312,8 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
   // adjusted or this should be a data section.
   LSDASection =
     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,
                                    SectionKind::getDataRel());
+  EHFrameSection =
+    getOrCreateSection("__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms"
+                       "+live_support", false, SectionKind::getReadOnly());
 }
 
 const MCSection *TargetLoweringObjectFileMachO::
index a8eaf5cf64e237befa0a944d53924e3f53dec637..24136ba31192fc4aa15c28f56abaa2ebfafd6ea0 100644 (file)
@@ -82,8 +82,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
   GlobalEHDirective = "\t.globl\t";
   SupportsWeakOmittedEHFrame = false;
   AbsoluteEHSectionOffsets = false;
-  DwarfEHFrameSection =
-  ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
 }
 
 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
@@ -115,7 +113,6 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
   // Exceptions handling
   SupportsExceptionHandling = true;
   AbsoluteEHSectionOffsets = false;
-  DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
 
   // On Linux we must declare when we can use a non-executable stack.
   if (TM.getSubtarget<X86Subtarget>().isLinux())