* [PATCH][AArch64] Fix wrong ".cfi_def_cfa_offset" in epilogue
@ 2014-08-20 8:43 Jiong Wang
2014-09-03 10:33 ` Marcus Shawcroft
0 siblings, 1 reply; 3+ messages in thread
From: Jiong Wang @ 2014-08-20 8:43 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
for *a function with frame size >= 512 and there is outgoing area*,
aarch64 gcc is generate wrong .cfi_def_cfa_offset for the last
stack adjustment instruction in epiloue.
given a simple testcase
test.c
===
int
main (int argc, char **argv)
{
char a[600];
int b = 0x10;
printf ("%d, %d, %d, %d, %d, %d, %d, %d\n", argc + 0, argc + 1, argc + 2,
argc + 3, argc + 4, argc + 5, argc + 6, argc + 7);
return 0;
}
gcc -O0 -g test.c
gdb ./a.out
(gdb) b main
(gdb) r
(gdb) b *0x0000000000400744
(break point at the end of the "main"
0x000000000040073c <+204>: ldp x29, x30, [sp],#16
0x0000000000400740 <+208>: add sp, sp, #0x280
0x0000000000400744 <+212>: ret <--- *set a break point here*
)
(gdb) c
Breakpoint 2, 0x0000000000400744 in main (argc=-1693278018, argv=0x0) at hello.c:9
(gdb) p/x b
* $1 = 0 while $1 should be 0x10 *
(gdb)
all local variable access are wrong, because gcc generated wrong cfa adjustment
add sp, sp, 640 <--- A
.cfi_def_cfa_offset 624 <--- B
ret
after A, the cfa offset should be zero, so B should be
.cfi_def_cfa_offset 0
no regression on aarch64-none-elf bare-metal full test.
ok for trunk?
thanks.
gcc/
* config/aarch64/aarch64.c (aarch64_expand_epilogue): Remove redundant cfa offset update.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-cfi-offset.patch --]
[-- Type: text/x-patch; name=fix-cfi-offset.patch, Size: 513 bytes --]
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 2ea55e8..53d3fa1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2551,11 +2551,6 @@ aarch64_expand_epilogue (bool for_sibcall)
RTX_FRAME_RELATED_P (insn) = 1;
}
}
-
- aarch64_set_frame_expr (gen_rtx_SET (Pmode, stack_pointer_rtx,
- plus_constant (Pmode,
- stack_pointer_rtx,
- offset)));
}
emit_use (gen_rtx_REG (DImode, LR_REGNUM));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][AArch64] Fix wrong ".cfi_def_cfa_offset" in epilogue
2014-08-20 8:43 [PATCH][AArch64] Fix wrong ".cfi_def_cfa_offset" in epilogue Jiong Wang
@ 2014-09-03 10:33 ` Marcus Shawcroft
2014-09-03 14:20 ` Jiong Wang
0 siblings, 1 reply; 3+ messages in thread
From: Marcus Shawcroft @ 2014-09-03 10:33 UTC (permalink / raw)
To: Jiong Wang; +Cc: gcc-patches
On 20 August 2014 09:43, Jiong Wang <jiong.wang@arm.com> wrote:
> gcc/
> * config/aarch64/aarch64.c (aarch64_expand_epilogue): Remove redundant cfa
> offset update.
OK
/Marcus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][AArch64] Fix wrong ".cfi_def_cfa_offset" in epilogue
2014-09-03 10:33 ` Marcus Shawcroft
@ 2014-09-03 14:20 ` Jiong Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jiong Wang @ 2014-09-03 14:20 UTC (permalink / raw)
To: Marcus Shawcroft; +Cc: gcc-patches, Richard Henderson
On 03/09/14 11:33, Marcus Shawcroft wrote:
> On 20 August 2014 09:43, Jiong Wang <jiong.wang@arm.com> wrote:
>
>> gcc/
>> * config/aarch64/aarch64.c (aarch64_expand_epilogue): Remove redundant cfa
>> offset update.
> OK
> /Marcus
thanks for review.
this fix is included in Richard H's patch at
https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02234.html
I'd drop my patch.
-- Jiong
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-03 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 8:43 [PATCH][AArch64] Fix wrong ".cfi_def_cfa_offset" in epilogue Jiong Wang
2014-09-03 10:33 ` Marcus Shawcroft
2014-09-03 14:20 ` Jiong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).