public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on aarch64 prologue code.
@ 2023-09-06 10:04 Iain Sandoe
  2023-09-06 12:43 ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Iain Sandoe @ 2023-09-06 10:04 UTC (permalink / raw)
  To: GCC Development; +Cc: Richard Sandiford

Hi Folks,

On the Darwin aarch64 port, we have a number of cleanup test fails (pretty much corresponding to the [still open] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39244).  However, let’s assume that bug could be a red herring..

the underlying reason is missing CFI for the set of the FP which [with Darwin’s LLVM libunwind impl.] breaks the unwind through the function that triggers a signal.

———

taking one of the functions in cleanup-8.C (say fn1) which contains calls.

what I am seeing is something like:

__ZL3fn1v:
LFB28:
; BLOCK 2, count:1073741824 (estimated locally) seq:0
; PRED: ENTRY [always]  count:1073741824 (estimated locally, freq 1.0000) (FALLTHRU)
	stp	x29, x30, [sp, -32]!
// LCFI; or .cfi_xxx is present
	mov	x29, sp
// *** NO  LCFI (or .cfi_cfa_xxxx when that is enabled)
	str	x19, [sp, 16]
// LCFI / .cfi_xxxx is present.
	adrp	x19, __ZL3fn4i@PAGE
	add	x19, x19, __ZL3fn4i@PAGEOFF;momd
	mov	x1, x19
	mov	w0, 11
	bl	_signal
<snip>

———

The reason seems to be that, in expand_prolog, emit_frame_chain is true (as we would expect, given that this function makes calls).  However ‘frame_pointer_needed' is false, so that the call to aarch64_add_offset() [line aarch64.cc:10405] does not add CFA adjustments to the load of x29.

———

I have currently worked around this by defining a TARGET_FRAME_POINTER_REQUIRED which returns true unless the function is a leaf (if that’s the correct solution, then all is fine).

———

However, it does seem odd that the existing code sets up the FP, but never produces any CFA for it.

So is this a possible bug, or just that I misunderstand the relevant set of circumstances?

thanks.
Iain


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-06 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06 10:04 Question on aarch64 prologue code Iain Sandoe
2023-09-06 12:43 ` Richard Sandiford
2023-09-06 14:03   ` Iain Sandoe
2023-09-06 17:22     ` Richard Earnshaw (lists)

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).