aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-02 01:34:32 +0000
committerChris Lattner <sabre@nondot.org>2009-08-02 01:34:32 +0000
commitc16c75ea9bb6aee277e8ca6ace41b3e852ae382e (patch)
tree9aee79510bf96a579b8f096a531b0dac8c982711 /llvm/lib
parentcc5e54e986a18b868d836e62aefbfbdee51e3f90 (diff)
downloadllvm-c16c75ea9bb6aee277e8ca6ace41b3e852ae382e.zip
llvm-c16c75ea9bb6aee277e8ca6ace41b3e852ae382e.tar.gz
llvm-c16c75ea9bb6aee277e8ca6ace41b3e852ae382e.tar.bz2
move getDwarfExceptionSection from TAI to TLOF and rename it to
getLSDASection() to be more specific. This makes it pretty obvious that the ELF LSDA section is being specified wrong in PIC mode. We're probably getting a lot of startup-time relocations to a readonly page, which is expensive and bad. Someone who cares about ELF C++ should investigate this. llvm-svn: 77847
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp9
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp2
-rw-r--r--llvm/lib/Target/TargetAsmInfo.cpp1
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp11
-rw-r--r--llvm/lib/Target/X86/X86TargetAsmInfo.cpp2
5 files changed, 15 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
index 8eb97af..b051f71 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -20,10 +20,11 @@
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
+#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/ADT/StringExtras.h"
using namespace llvm;
@@ -539,10 +540,8 @@ void DwarfException::EmitExceptionTable() {
unsigned SizeAlign = (4 - TotalSize) & 3;
// Begin the exception table.
- //MCSection *LSDASection = TAI->getLSDASection();
- //Asm->SwitchToSection(LSDASection);
-
- Asm->SwitchToDataSection(TAI->getDwarfExceptionSection());
+ const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
+ Asm->SwitchToSection(LSDASection);
Asm->EmitAlignment(2, 0, 0, false);
O << "GCC_except_table" << SubprogramCount << ":\n";
diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 3c8ab94..2e66cb8 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -28,7 +28,6 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
DwarfEHFrameSection =
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
- DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
GlobalEHDirective = "\t.globl\t";
SupportsWeakOmittedEHFrame = false;
}
@@ -73,7 +72,6 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
SupportsExceptionHandling = true;
AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
- DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
}
diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp
index 80bb90e..e961f2a 100644
--- a/llvm/lib/Target/TargetAsmInfo.cpp
+++ b/llvm/lib/Target/TargetAsmInfo.cpp
@@ -108,7 +108,6 @@ TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm) : TM(tm) {
DwarfRangesSection = ".debug_ranges";
DwarfMacroInfoSection = ".debug_macinfo";
DwarfEHFrameSection = ".eh_frame";
- DwarfExceptionSection = ".gcc_except_table";
AsmTransCBE = 0;
}
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index a86946d..d04e5c0 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -36,6 +36,7 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
ReadOnlySection = 0;
StaticCtorSection = 0;
StaticDtorSection = 0;
+ LSDASection = 0;
}
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -302,6 +303,14 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
getOrCreateSection(".ctors", false, SectionKind::getDataRel());
StaticDtorSection =
getOrCreateSection(".dtors", false, SectionKind::getDataRel());
+
+
+ // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
+ // it contains relocatable pointers. In PIC mode, this is probably a big
+ // runtime hit for C++ apps. Either the contents of the LSDA need to be
+ // adjusted or this should be a data section.
+ LSDASection =
+ getOrCreateSection(".gcc_except_table", false, SectionKind::getReadOnly());
}
@@ -537,6 +546,8 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
getOrCreateSection(".mod_term_func", true, SectionKind::getDataRel());
}
+ LSDASection = getOrCreateSection("__DATA,__gcc_except_tab", false,
+ SectionKind::getDataRel());
}
const MCSection *TargetLoweringObjectFileMachO::
diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
index c30f337..4c90308 100644
--- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -84,7 +84,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection =
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
- DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
}
unsigned X86DarwinTargetAsmInfo::PreferredEHDataFormat() const {
@@ -133,7 +132,6 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
SupportsExceptionHandling = true;
AbsoluteEHSectionOffsets = false;
DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
- DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
// On Linux we must declare when we can use a non-executable stack.
if (TM.getSubtarget<X86Subtarget>().isLinux())