mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-12 15:51:35 +00:00
Fix and enable EH for x86-64 Darwin. Adds
ShortenEHDataFor64Bits as a not-very-accurate abstraction to cover all the changes in DwarfWriter. Some cosmetic changes to Darwin assembly code for gcc testsuite compatibility. llvm-svn: 46029
This commit is contained in:
parent
214c1c3461
commit
319c7bb405
@ -313,6 +313,10 @@ namespace llvm {
|
||||
/// handle a weak_definition of constant 0 for an omitted EH frame.
|
||||
bool SupportsWeakOmittedEHFrame; // Defaults to true.
|
||||
|
||||
/// ShortenEHDataON64Bit - True if target exception table format requires
|
||||
/// 32-bit data in certain places even when targeting 64-bits.
|
||||
bool ShortenEHDataOn64Bit; // Defaults to false.
|
||||
|
||||
/// DwarfSectionOffsetDirective - Special section offset directive.
|
||||
const char* DwarfSectionOffsetDirective; // Defaults to NULL
|
||||
|
||||
@ -592,6 +596,9 @@ namespace llvm {
|
||||
bool getSupportsWeakOmittedEHFrame() const {
|
||||
return SupportsWeakOmittedEHFrame;
|
||||
}
|
||||
bool getShortenEHDataOn64Bit() const {
|
||||
return ShortenEHDataOn64Bit;
|
||||
}
|
||||
const char *getDwarfSectionOffsetDirective() const {
|
||||
return DwarfSectionOffsetDirective;
|
||||
}
|
||||
|
@ -2835,11 +2835,13 @@ private:
|
||||
|
||||
Asm->EOL("Personality (pcrel sdata4 indirect)");
|
||||
|
||||
PrintRelDirective();
|
||||
PrintRelDirective(TAI->getShortenEHDataOn64Bit());
|
||||
O << TAI->getPersonalityPrefix();
|
||||
Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
|
||||
O << TAI->getPersonalitySuffix();
|
||||
O << "-" << TAI->getPCSymbol();
|
||||
if (!TAI->getShortenEHDataOn64Bit()) {
|
||||
O << "-" << TAI->getPCSymbol();
|
||||
}
|
||||
Asm->EOL("Personality");
|
||||
|
||||
Asm->EmitULEB128Bytes(DW_EH_PE_pcrel);
|
||||
@ -2917,7 +2919,7 @@ private:
|
||||
// If there is a personality and landing pads then point to the language
|
||||
// specific data area in the exception table.
|
||||
if (EHFrameInfo.PersonalityIndex) {
|
||||
Asm->EmitULEB128Bytes(4);
|
||||
Asm->EmitULEB128Bytes(TAI->getShortenEHDataOn64Bit() ? 8 : 4);
|
||||
Asm->EOL("Augmentation size");
|
||||
|
||||
if (EHFrameInfo.hasLandingPads) {
|
||||
@ -3284,24 +3286,26 @@ private:
|
||||
}
|
||||
|
||||
EmitSectionOffset(BeginTag, "eh_func_begin", BeginNumber, SubprogramCount,
|
||||
false, true);
|
||||
TAI->getShortenEHDataOn64Bit(), true);
|
||||
Asm->EOL("Region start");
|
||||
|
||||
if (!S.EndLabel) {
|
||||
EmitDifference("eh_func_end", SubprogramCount, BeginTag, BeginNumber);
|
||||
EmitDifference("eh_func_end", SubprogramCount, BeginTag, BeginNumber,
|
||||
TAI->getShortenEHDataOn64Bit());
|
||||
} else {
|
||||
EmitDifference("label", S.EndLabel, BeginTag, BeginNumber);
|
||||
EmitDifference("label", S.EndLabel, BeginTag, BeginNumber,
|
||||
TAI->getShortenEHDataOn64Bit());
|
||||
}
|
||||
Asm->EOL("Region length");
|
||||
|
||||
if (!S.PadLabel) {
|
||||
if (TD->getPointerSize() == sizeof(int32_t))
|
||||
if (TD->getPointerSize() == sizeof(int32_t) || TAI->getShortenEHDataOn64Bit())
|
||||
Asm->EmitInt32(0);
|
||||
else
|
||||
Asm->EmitInt64(0);
|
||||
} else {
|
||||
EmitSectionOffset("label", "eh_func_begin", S.PadLabel, SubprogramCount,
|
||||
false, true);
|
||||
TAI->getShortenEHDataOn64Bit(), true);
|
||||
}
|
||||
Asm->EOL("Landing pad");
|
||||
|
||||
|
@ -50,6 +50,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
}
|
||||
SwitchToSectionDirective = "\t.section ";
|
||||
UsedDirective = "\t.no_dead_strip\t";
|
||||
WeakDefDirective = "\t.weak_definition ";
|
||||
WeakRefDirective = "\t.weak_reference ";
|
||||
|
@ -358,7 +358,8 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
||||
|
||||
O << "\n";
|
||||
|
||||
if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) {
|
||||
if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI &&
|
||||
!Subtarget->is64Bit()) {
|
||||
// Add the (possibly multiple) personalities to the set of global values.
|
||||
const std::vector<Function *>& Personalities = MMI->getPersonalities();
|
||||
|
||||
|
@ -59,6 +59,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
||||
SixteenByteConstantSection = "\t.literal16\n";
|
||||
ReadOnlySection = "\t.const\n";
|
||||
LCOMMDirective = "\t.lcomm\t";
|
||||
SwitchToSectionDirective = "\t.section ";
|
||||
COMMDirectiveTakesAlignment = false;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
if (TM.getRelocationModel() == Reloc::Static) {
|
||||
@ -68,8 +69,13 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
}
|
||||
PersonalityPrefix = "L";
|
||||
PersonalitySuffix = "$non_lazy_ptr";
|
||||
if (Subtarget->is64Bit()) {
|
||||
PersonalityPrefix = "";
|
||||
PersonalitySuffix = "+4@GOTPCREL";
|
||||
} else {
|
||||
PersonalityPrefix = "L";
|
||||
PersonalitySuffix = "$non_lazy_ptr";
|
||||
}
|
||||
NeedsIndirectEncoding = true;
|
||||
InlineAsmStart = "# InlineAsm Start";
|
||||
InlineAsmEnd = "# InlineAsm End";
|
||||
@ -102,11 +108,12 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
||||
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
|
||||
|
||||
// Exceptions handling
|
||||
if (!Subtarget->is64Bit())
|
||||
SupportsExceptionHandling = true;
|
||||
SupportsExceptionHandling = true;
|
||||
GlobalEHDirective = "\t.globl\t";
|
||||
SupportsWeakOmittedEHFrame = false;
|
||||
AbsoluteEHSectionOffsets = false;
|
||||
if (Subtarget->is64Bit())
|
||||
ShortenEHDataOn64Bit = true;
|
||||
DwarfEHFrameSection =
|
||||
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
|
||||
DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
|
||||
|
Loading…
x
Reference in New Issue
Block a user