mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Attempt #2:
Place the EH table in the __TEXT section on MachO. It saves space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -727,7 +727,8 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// somewhere. This predicate should be moved to a shared location that is
|
// somewhere. This predicate should be moved to a shared location that is
|
||||||
// in target-independent code.
|
// in target-independent code.
|
||||||
//
|
//
|
||||||
if (LSDASection->getKind().isWriteable() ||
|
if ((LSDASection->getKind().isWriteable() &&
|
||||||
|
!LSDASection->getKind().isDataRel()) ||
|
||||||
Asm->TM.getRelocationModel() == Reloc::Static)
|
Asm->TM.getRelocationModel() == Reloc::Static)
|
||||||
TTypeFormat = dwarf::DW_EH_PE_absptr;
|
TTypeFormat = dwarf::DW_EH_PE_absptr;
|
||||||
else
|
else
|
||||||
@ -917,14 +918,35 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit the Catch TypeInfos.
|
// Emit the Catch TypeInfos.
|
||||||
for (std::vector<GlobalVariable *>::const_reverse_iterator
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
|
unsigned Index = 1;
|
||||||
const GlobalVariable *GV = *I;
|
|
||||||
PrintRelDirective();
|
|
||||||
|
|
||||||
if (GV) {
|
for (std::vector<GlobalVariable *>::const_reverse_iterator
|
||||||
O << Asm->Mang->getMangledName(GV);
|
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 (!IsTypeInfoPCRel)
|
||||||
|
TypeInfoRef = CreateLabelDiff(TypeInfoRef, "typeinforef_addr", Index);
|
||||||
|
|
||||||
|
O << MAI->getData32bitsDirective();
|
||||||
|
TypeInfoRef->print(O, MAI);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
PrintRelDirective();
|
||||||
O << "0x0";
|
O << "0x0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +783,7 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exception Handling.
|
// Exception Handling.
|
||||||
LSDASection = getMachOSection("__DATA", "__gcc_except_tab", 0,
|
LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
|
||||||
SectionKind::getDataRel());
|
SectionKind::getDataRel());
|
||||||
EHFrameSection =
|
EHFrameSection =
|
||||||
getMachOSection("__TEXT", "__eh_frame",
|
getMachOSection("__TEXT", "__eh_frame",
|
||||||
|
Reference in New Issue
Block a user