aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c11
-rw-r--r--gcc/config/darwin.h3
-rw-r--r--gcc/doc/tm.texi4
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/dwarf2out.c14
-rw-r--r--gcc/target.def10
7 files changed, 43 insertions, 2 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
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 833320b..a783a21 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9560,6 +9560,10 @@ given instruction. This is only used when @code{TARGET_EXCEPT_UNWIND_INFO}
returns @code{UI_TARGET}.
@end deftypefn
+@deftypefn {Target Hook} rtx TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT (rtx @var{origsymbol}, bool @var{pubvis})
+If necessary, modify personality and LSDA references to handle indirection. The original symbol is in @code{origsymbol} and if @code{pubvis} is true the symbol is visible outside the TU.
+@end deftypefn
+
@deftypevr {Target Hook} bool TARGET_ASM_UNWIND_EMIT_BEFORE_INSN
True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before the assembly for @var{insn} has been emitted, false if the hook should be called afterward.
@end deftypevr
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 58109be..897f289 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -6456,6 +6456,8 @@ the jump-table.
@hook TARGET_ASM_UNWIND_EMIT
+@hook TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT
+
@hook TARGET_ASM_UNWIND_EMIT_BEFORE_INSN
@node Exception Region Output
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);
diff --git a/gcc/target.def b/gcc/target.def
index b916635..71411d8 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -185,6 +185,16 @@ DEFHOOK
void, (rtx personality),
NULL)
+/* If necessary, modify personality and LSDA references to handle
+ indirection. This is used when the assembler supports CFI directives. */
+DEFHOOK
+(make_eh_symbol_indirect,
+ "If necessary, modify personality and LSDA references to handle indirection.\
+ The original symbol is in @code{origsymbol} and if @code{pubvis} is true\
+ the symbol is visible outside the TU.",
+ rtx, (rtx origsymbol, bool pubvis),
+ NULL)
+
/* Emit any directives required to unwind this instruction. */
DEFHOOK
(unwind_emit,