[PATCH] D41300: [ARM] Fix PR35379 - incorrect unwind information when compiling with -Oz
Ryan Prichard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 20:52:07 PST 2017
rprichard added a comment.
If I understand correctly, with this fix, we'll output something like this for the original test case (https://godbolt.org/g/rJRr75):
work:
.save {r11, lr}
push {r9, r10, r11, lr}
.setfp r11, sp, #8
add r11, sp, #8
...
The .save directive apparently only accounts for 8 bytes of SP adjustment, but SP was decremented by 16. If I assemble it, then the `readelf -u` output looks broken:
$ arm-linux-androideabi-gcc -c test.s && readelf -u test.o
Unwind table index '.ARM.exidx' at offset 0x64 contains 1 entries:
0x0 <work>: @0x0
Compact model index: 1
0x9b vsp = r11
0x41 vsp = vsp - 8
0x84 0x80 pop {r11, r14}
0xb0 finish
0xb0 finish
(r11 points at the saved {r11, r14} registers. The `vsp = vsp - 8` adjustment is wrong.)
If the tryFoldSPUpdateIntoPushPop optimization is disabled (e.g. by compiling with -Os instead), there is a separate 8-byte stack adjustment, which is marked with a .pad directive:
.pad #8
sub sp, sp, #8
It looks like EmitUnwindingInstruction also emits the .pad directive. If I add a `.pad #8` directive to my assembly file, immediately after the `.save` directive, then the `readelf -u` output is fixed. (i.e. The `vsp = vsp - 8` line disappears.)
Repository:
rL LLVM
https://reviews.llvm.org/D41300
More information about the llvm-commits
mailing list