gcc/libgcc
Matthieu Longo 9e1c71bab5 dwarf2: add hooks for architecture-specific CFIs
Architecture-specific CFI directives are currently declared an processed
among others architecture-independent CFI directives in gcc/dwarf2* files.
This approach creates confusion, specifically in the case of DWARF
instructions in the vendor space and using the same instruction code.

Such a clash currently happen between DW_CFA_GNU_window_save (used on
SPARC) and DW_CFA_AARCH64_negate_ra_state (used on AArch64), and both
having the same instruction code 0x2d.
Then AArch64 compilers generates a SPARC CFI directive (.cfi_window_save)
instead of .cfi_negate_ra_state, contrarilly to what is expected in
[DWARF for the Arm 64-bit Architecture (AArch64)](https://github.com/
ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst).

This refactoring does not solve completely the problem, but improve the
situation by moving some of the processing of those directives (more
specifically their output in the assembly) to the backend via 2 target
hooks:
- DW_CFI_OPRND1_DESC: parse the first operand of the directive (if any).
- OUTPUT_CFI_DIRECTIVE: output the CFI directive as a string.

Additionally, this patch also contains a renaming of an enum used for
return address mangling on AArch64.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc
	(aarch64_output_cfi_directive): New hook for CFI directives.
	(aarch64_dw_cfi_oprnd1_desc): Same.
	(TARGET_OUTPUT_CFI_DIRECTIVE): Hook for output_cfi_directive.
	(TARGET_DW_CFI_OPRND1_DESC): Hook for dw_cfi_oprnd1_desc.
	* config/sparc/sparc.cc
	(sparc_output_cfi_directive): New hook for CFI directives.
	(sparc_dw_cfi_oprnd1_desc): Same.
	(TARGET_OUTPUT_CFI_DIRECTIVE): Hook for output_cfi_directive.
	(TARGET_DW_CFI_OPRND1_DESC): Hook for dw_cfi_oprnd1_desc.
	* coretypes.h
	(struct dw_cfi_node): Forward declaration of CFI type from
	gcc/dwarf2out.h.
	(enum dw_cfi_oprnd_type): Same.
	(enum dwarf_call_frame_info): Same.
	* doc/tm.texi: Regenerated from doc/tm.texi.in.
	* doc/tm.texi.in: Add doc for new target hooks.
	type of enum to allow forward declaration.
	* dwarf2cfi.cc
	(struct dw_cfi_row): Update the description for window_save
	and ra_mangled.
	(dwarf2out_frame_debug_cfa_negate_ra_state): Use AArch64 CFI
	directive instead of the SPARC one.
	(change_cfi_row): Use the right CFI directive's name for RA
	mangling.
	(output_cfi): Remove explicit architecture-specific CFI
	directive DW_CFA_GNU_window_save that falls into default case.
	(output_cfi_directive): Use target hook as default.
	* dwarf2out.cc (dw_cfi_oprnd1_desc): Use target hook as default.
	* dwarf2out.h (enum dw_cfi_oprnd_type): specify underlying type
	of enum to allow forward declaration.
	(dw_cfi_oprnd1_desc): Call target hook.
	(output_cfi_directive): Use dw_cfi_ref instead of struct
	dw_cfi_node *.
	* hooks.cc
	(hook_bool_dwcfi_dwcfioprndtyperef_false): New.
	(hook_bool_FILEptr_dwcfiptr_false): New.
	* hooks.h
	(hook_bool_dwcfi_dwcfioprndtyperef_false): New.
	(hook_bool_FILEptr_dwcfiptr_false): New.
	* target.def: Documentation for new hooks.

include/ChangeLog:

	* dwarf2.h (enum dwarf_call_frame_info): specify underlying

libffi/ChangeLog:

	* include/ffi_cfi.h (cfi_negate_ra_state): Declare AArch64 cfi
	directive.

libgcc/ChangeLog:

	* config/aarch64/aarch64-asm.h (PACIASP): Replace SPARC CFI
	directive by AArch64 one.
	(AUTIASP): Same.

libitm/ChangeLog:

	* config/aarch64/sjlj.S: Replace SPARC CFI directive by
	AArch64 one.

gcc/testsuite/ChangeLog:

	* g++.target/aarch64/pr94515-1.C: Replace SPARC CFI directive by
	AArch64 one.
	* g++.target/aarch64/pr94515-2.C: Same.
2024-09-23 15:37:05 +01:00
..
c++-minimal Update copyright years. 2024-01-03 12:19:35 +01:00
config dwarf2: add hooks for architecture-specific CFIs 2024-09-23 15:37:05 +01:00
soft-fp [RISC-V] Add support for _Bfloat16 2024-05-06 15:39:12 -06:00
ChangeLog Daily bump. 2024-09-23 00:18:00 +00:00
config.host libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. 2024-09-23 15:24:21 +01:00
config.in Remove obsolete Solaris 11.3 support 2024-05-07 10:45:55 +02:00
configure libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. 2024-09-23 15:24:21 +01:00
configure.ac libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. 2024-09-23 15:24:21 +01:00
crtstuff.c Update copyright years. 2024-01-03 12:19:35 +01:00
dfp-bit.c Update copyright years. 2024-01-03 12:19:35 +01:00
dfp-bit.h Update copyright years. 2024-01-03 12:19:35 +01:00
divmod.c Update copyright years. 2024-01-03 12:19:35 +01:00
emutls.c Update copyright years. 2024-01-03 12:19:35 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2024-01-03 12:19:35 +01:00
find-symver.awk Update copyright years. 2024-01-03 12:19:35 +01:00
fixed-bit.c Update copyright years. 2024-01-03 12:19:35 +01:00
fixed-bit.h Update copyright years. 2024-01-03 12:19:35 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2024-01-03 12:19:35 +01:00
fp-bit.h Update copyright years. 2024-01-03 12:19:35 +01:00
gbl-ctors.h Update copyright years. 2024-01-03 12:19:35 +01:00
gcov.h Update copyright years. 2024-01-03 12:19:35 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2024-01-03 12:19:35 +01:00
generic-morestack.c Update copyright years. 2024-01-03 12:19:35 +01:00
generic-morestack.h Update copyright years. 2024-01-03 12:19:35 +01:00
gstdint.h
gthr-posix.h Update copyright years. 2024-01-03 12:19:35 +01:00
gthr-single.h Update copyright years. 2024-01-03 12:19:35 +01:00
gthr.h libgcc: Do use weakrefs for glibc 2.34 on GNU Hurd 2024-04-30 09:00:07 +02:00
hardcfr.c Update copyright years. 2024-01-03 12:19:35 +01:00
libgcc2.c libgcc: Another __divmodbitint4 bug fix [PR114762] 2024-04-19 08:47:09 +02:00
libgcc2.h libgcc: Avoid warnings on __gcc_nested_func_ptr_created [PR113402] 2024-02-01 21:10:10 +01:00
libgcc-std.ver.in Fix __builtin_nested_func_ptr_{created,deleted} symbol versions [PR113402] 2024-01-28 10:59:34 +00:00
libgcov-driver-system.c Update copyright years. 2024-01-03 12:19:35 +01:00
libgcov-driver.c Update copyright years. 2024-01-03 12:19:35 +01:00
libgcov-interface.c Update copyright years. 2024-01-03 12:19:35 +01:00
libgcov-merge.c Add condition coverage (MC/DC) 2024-04-04 20:28:44 +02:00
libgcov-profiler.c Update copyright years. 2024-01-03 12:19:35 +01:00
libgcov-util.c Silence two instances of -Wcalloc-transposed-args 2024-05-03 13:24:10 +02:00
libgcov.h Update copyright years. 2024-01-03 12:19:35 +01:00
Makefile.in libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. 2024-09-23 15:24:21 +01:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2024-01-03 12:19:35 +01:00
mkmap-flat.awk Update copyright years. 2024-01-03 12:19:35 +01:00
mkmap-symver.awk Update copyright years. 2024-01-03 12:19:35 +01:00
offloadstuff.c Update copyright years. 2024-01-03 12:19:35 +01:00
shared-object.mk
siditi-object.mk
static-object.mk
strub.c Update copyright years. 2024-01-03 12:19:35 +01:00
sync.c Update copyright years. 2024-01-03 12:19:35 +01:00
udivhi3.c Update copyright years. 2024-01-03 12:19:35 +01:00
udivmod.c Update copyright years. 2024-01-03 12:19:35 +01:00
udivmodhi4.c Update copyright years. 2024-01-03 12:19:35 +01:00
udivmodsi4.c Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-arm-common.inc libgcc: arm: fix build for FDPIC target 2024-03-25 11:19:34 -07:00
unwind-c.c Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-compat.c Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-compat.h Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-dw2-btree.h Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-dw2-execute_cfa.h aarch64: store signing key and signing method in DWARF _Unwind_FrameState 2024-09-23 15:05:59 +01:00
unwind-dw2-fde-compat.c Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-dw2-fde-dip.c libgcc, nios2: Fix exception handling on nios2 with -fpic 2024-01-12 04:50:22 +00:00
unwind-dw2-fde.c Fix up duplicated words mostly in comments, part 1 2024-04-02 13:39:11 +02:00
unwind-dw2-fde.h Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-dw2.c aarch64: skip copy of RA state register into target context 2024-09-23 15:12:07 +01:00
unwind-dw2.h libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. 2024-09-23 15:24:21 +01:00
unwind-generic.h Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-pe.h Update copyright years. 2024-01-03 12:19:35 +01:00
unwind-seh.c libgcc: fix SEH C++ rethrow semantics [PR113337] 2024-02-06 08:23:26 +00:00
unwind-sjlj.c Update copyright years. 2024-01-03 12:19:35 +01:00
unwind.inc Update copyright years. 2024-01-03 12:19:35 +01:00
vtv_end_preinit.c Update copyright years. 2024-01-03 12:19:35 +01:00
vtv_end.c Update copyright years. 2024-01-03 12:19:35 +01:00
vtv_start_preinit.c Update copyright years. 2024-01-03 12:19:35 +01:00
vtv_start.c Update copyright years. 2024-01-03 12:19:35 +01:00