[llvm-commits] [llvm] r89270 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfException.cpp Target/TargetLoweringObjectFile.cpp
Bill Wendling
isanbard at gmail.com
Wed Nov 18 15:18:47 PST 2009
Author: void
Date: Wed Nov 18 17:18:46 2009
New Revision: 89270
URL: http://llvm.org/viewvc/llvm-project?rev=89270&view=rev
Log:
Attempt #2:
Place the EH table in the __TEXT section on MachO. It saves space.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=89270&r1=89269&r2=89270&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Wed Nov 18 17:18:46 2009
@@ -727,7 +727,8 @@
// somewhere. This predicate should be moved to a shared location that is
// in target-independent code.
//
- if (LSDASection->getKind().isWriteable() ||
+ if ((LSDASection->getKind().isWriteable() &&
+ !LSDASection->getKind().isDataRel()) ||
Asm->TM.getRelocationModel() == Reloc::Static)
TTypeFormat = dwarf::DW_EH_PE_absptr;
else
@@ -917,14 +918,35 @@
}
// Emit the Catch TypeInfos.
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+ unsigned Index = 1;
+
for (std::vector<GlobalVariable *>::const_reverse_iterator
- I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
- const GlobalVariable *GV = *I;
- PrintRelDirective();
+ I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I, ++Index) {
+ const GlobalVariable *TI = *I;
+
+ if (TI) {
+ if (!LSDASection->getKind().isDataRel() &&
+ (TTypeFormat == dwarf::DW_EH_PE_absptr ||
+ TI->getLinkage() == GlobalValue::InternalLinkage)) {
+ // Print out the unadorned name of the type info.
+ PrintRelDirective();
+ O << Asm->Mang->getMangledName(TI);
+ } else {
+ bool IsTypeInfoIndirect = false, IsTypeInfoPCRel = false;
+ const MCExpr *TypeInfoRef =
+ TLOF.getSymbolForDwarfGlobalReference(TI, Asm->Mang, Asm->MMI,
+ IsTypeInfoIndirect,
+ IsTypeInfoPCRel);
- if (GV) {
- O << Asm->Mang->getMangledName(GV);
+ if (!IsTypeInfoPCRel)
+ TypeInfoRef = CreateLabelDiff(TypeInfoRef, "typeinforef_addr", Index);
+
+ O << MAI->getData32bitsDirective();
+ TypeInfoRef->print(O, MAI);
+ }
} else {
+ PrintRelDirective();
O << "0x0";
}
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=89270&r1=89269&r2=89270&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Nov 18 17:18:46 2009
@@ -783,7 +783,7 @@
}
// Exception Handling.
- LSDASection = getMachOSection("__DATA", "__gcc_except_tab", 0,
+ LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
SectionKind::getDataRel());
EHFrameSection =
getMachOSection("__TEXT", "__eh_frame",
More information about the llvm-commits
mailing list