aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-09-16 15:11:00 +0100
committerIain Sandoe <iain@sandoe.co.uk>2020-11-11 20:44:02 +0000
commit5d46ec3db21d8c8926f15a634b2d6570536db5f1 (patch)
tree319e91edab9ba1c12a694b210053af3f339bdb9a /gcc/dwarf2out.c
parent9227f81db7a0b38dd14ce4b48ca50c33cf8d5e1c (diff)
downloadgcc-5d46ec3db21d8c8926f15a634b2d6570536db5f1.zip
gcc-5d46ec3db21d8c8926f15a634b2d6570536db5f1.tar.gz
gcc-5d46ec3db21d8c8926f15a634b2d6570536db5f1.tar.bz2
CFI-handling : Add a hook to allow target-specific Personality and LSDA indirections.
At present, the output of .cfi_personality and .cfi_lsda assumes ELF semantics for indirections. This isn't suitable for all targets and is one blocker to moving Darwin to use .cfi_xxxx. The patch adds a target hook that allows non-ELF targets to use indirections appropriate to their needs. gcc/ChangeLog: * config/darwin-protos.h (darwin_make_eh_symbol_indirect): New. * config/darwin.c (darwin_make_eh_symbol_indirect): New. Use Mach-O semantics for personality and ldsa indirections. * config/darwin.h (TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT): New. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Add TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT hook. * dwarf2out.c (dwarf2out_do_cfi_startproc): If the target defines a hook for indirecting personality and ldsa references, use that otherwise default to ELF semantics. * target.def (make_eh_symbol_indirect): New target hook.
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index bc32a17..bea02f9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -991,7 +991,12 @@ dwarf2out_do_cfi_startproc (bool second)
in the assembler. Further, the assembler can't handle any
of the weirder relocation types. */
if (enc & DW_EH_PE_indirect)
- ref = dw2_force_const_mem (ref, true);
+ {
+ if (targetm.asm_out.make_eh_symbol_indirect != NULL)
+ ref = targetm.asm_out.make_eh_symbol_indirect (ref, true);
+ else
+ ref = dw2_force_const_mem (ref, true);
+ }
fprintf (asm_out_file, "\t.cfi_personality %#x,", enc);
output_addr_const (asm_out_file, ref);
@@ -1009,7 +1014,12 @@ dwarf2out_do_cfi_startproc (bool second)
SYMBOL_REF_FLAGS (ref) = SYMBOL_FLAG_LOCAL;
if (enc & DW_EH_PE_indirect)
- ref = dw2_force_const_mem (ref, true);
+ {
+ if (targetm.asm_out.make_eh_symbol_indirect != NULL)
+ ref = targetm.asm_out.make_eh_symbol_indirect (ref, true);
+ else
+ ref = dw2_force_const_mem (ref, true);
+ }
fprintf (asm_out_file, "\t.cfi_lsda %#x,", enc);
output_addr_const (asm_out_file, ref);