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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46029 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 1f7618a..8b315be 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -2835,11 +2835,13 @@
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 @@
// 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 @@
}
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");