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
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index aa52d87..fec1ad7 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -56,7 +56,7 @@
     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 @@
 
   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.
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 0696a90..e8b1824 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -26,8 +26,6 @@
   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 @@
   if (!TM.getSubtargetImpl()->isPPC64())
     SupportsExceptionHandling = true;
   AbsoluteEHSectionOffsets = false;
-  DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
 }
 
 
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index a4143ce..7da3715 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -96,7 +96,6 @@
   DwarfARangesSection = ".debug_aranges";
   DwarfRangesSection = ".debug_ranges";
   DwarfMacroInfoSection = ".debug_macinfo";
-  DwarfEHFrameSection = ".eh_frame";
   AsmTransCBE = 0;
 }
 
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index d04e5c0..38ae71e 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -37,6 +37,7 @@
   StaticCtorSection = 0;
   StaticDtorSection = 0;
   LSDASection = 0;
+  EHFrameSection = 0;
 }
 
 TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -311,6 +312,8 @@
   // 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 @@
   
   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::
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index a8eaf5c..24136ba 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -82,8 +82,6 @@
   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 @@
   // 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())