Skip to content

Commit a634991

Browse files
committed
Merge 80414 from mainline.
Make the augmentation size and next set of bytes agree on size, and make the reference pointer size as it should be. Fixes an abort on a testcase derived from libunwind's personality test in 64-bit. llvm-svn: 81701
1 parent fea9431 commit a634991

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,19 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
203203
// If there is a personality and landing pads then point to the language
204204
// specific data area in the exception table.
205205
if (EHFrameInfo.PersonalityIndex) {
206-
Asm->EmitULEB128Bytes(4);
206+
bool is4Byte = TD->getPointerSize() == sizeof(int32_t);
207+
208+
Asm->EmitULEB128Bytes(is4Byte ? 4 : 8);
207209
Asm->EOL("Augmentation size");
208210

209211
if (EHFrameInfo.hasLandingPads)
210-
EmitReference("exception", EHFrameInfo.Number, true, true);
211-
else
212-
Asm->EmitInt32((int)0);
212+
EmitReference("exception", EHFrameInfo.Number, true, false);
213+
else {
214+
if (is4Byte)
215+
Asm->EmitInt32((int)0);
216+
else
217+
Asm->EmitInt64((int)0);
218+
}
213219
Asm->EOL("Language Specific Data Area");
214220
} else {
215221
Asm->EmitULEB128Bytes(0);

0 commit comments

Comments
 (0)