Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/test/tools/llvm-readobj/COFF/arm64-packed-unwind.s
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@
// CHECK-NEXT: FrameSize: 32
// CHECK-NEXT: Prologue [
// CHECK-NEXT: sub sp, sp, #16
// CHECK-NEXT: INVALID!
// CHECK-NEXT: stp x19, lr, [sp]
// CHECK-NEXT: sub sp, sp, #16
// CHECK-NEXT: end
// CHECK-NEXT: ]
// CHECK-NEXT: }
Expand Down
12 changes: 8 additions & 4 deletions llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,10 +1457,14 @@ bool Decoder::dumpPackedARM64Entry(const object::COFFObjectFile &COFF,
// The last register, an odd register without a pair
if (RF.CR() == 1) {
if (I == 0) { // If this is the only register pair
// CR=1 combined with RegI=1 doesn't map to a documented case;
// it doesn't map to any regular unwind info opcode, and the
// actual unwinder doesn't support it.
SW.startLine() << "INVALID!\n";
// CR=1 combined with RegI=1 maps to a special case; there's
// no unwind info opcode that saves a GPR together with LR
// with writeback to sp (no save_lrpair_x).
// Instead, this case expands to two instructions; a preceding
// (in prologue execution order) "sub sp, sp, #16", followed
// by a regular "stp x19, lr, [sp]" (save_lrpair).
SW.startLine() << format("stp x%d, lr, [sp]\n", 19);
SW.startLine() << format("sub sp, sp, #%d\n", SavSZ);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we print a warning if RegF() > 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, I don't think that's necessary. It is well defined and works correctly on the latest versions, so it makes sense to just dump it the right way, and we just avoid creating it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

} else
SW.startLine() << format("stp x%d, lr, [sp, #%d]\n", 19 + 2 * I,
16 * I);
Expand Down