diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2019-09-16 15:11:00 +0100 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2020-11-11 20:44:02 +0000 |
commit | 5d46ec3db21d8c8926f15a634b2d6570536db5f1 (patch) | |
tree | 319e91edab9ba1c12a694b210053af3f339bdb9a /gcc/config | |
parent | 9227f81db7a0b38dd14ce4b48ca50c33cf8d5e1c (diff) | |
download | gcc-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/config')
-rw-r--r-- | gcc/config/darwin-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/darwin.c | 11 | ||||
-rw-r--r-- | gcc/config/darwin.h | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 49c540f..3f222c3 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -69,6 +69,7 @@ extern void darwin_non_lazy_pcrel (FILE *, rtx); extern void darwin_emit_unwind_label (FILE *, tree, int, int); extern void darwin_emit_except_table_label (FILE *); +extern rtx darwin_make_eh_symbol_indirect (rtx, bool); extern void darwin_pragma_ignore (struct cpp_reader *); extern void darwin_pragma_options (struct cpp_reader *); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index dd4857f..3265e3e 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -2225,6 +2225,17 @@ darwin_emit_except_table_label (FILE *file) ASM_OUTPUT_LABEL (file, section_start_label); } +rtx +darwin_make_eh_symbol_indirect (rtx orig, bool ARG_UNUSED (pubvis)) +{ + if (DARWIN_PPC == 0 && TARGET_64BIT) + return orig; + + return gen_rtx_SYMBOL_REF (Pmode, + machopic_indirection_name (orig, + /*stub_p=*/false)); +} + /* Return, and mark as used, the name of the stub for the mcount function. Currently, this is only called by X86 code in the expansion of the FUNCTION_PROFILER macro, when stubs are enabled. */ diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index f9d4fec..5a76631 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -591,6 +591,9 @@ extern GTY(()) int darwin_ms_struct; /* Emit a label to separate the exception table. */ #define TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL darwin_emit_except_table_label +/* Make an EH (personality or LDSA) symbol indirect as needed. */ +#define TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT darwin_make_eh_symbol_indirect + /* Our profiling scheme doesn't LP labels and counter words. */ #define NO_PROFILE_COUNTERS 1 |