aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips/mips.h
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-09-20 10:36:05 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2009-09-20 10:36:05 +0000
commit49576e25cbab7891bc3296e2bcd84d0c284560a6 (patch)
treea84e1e4e16568ba17408fdb8f2fe99d6a35e7ea4 /gcc/config/mips/mips.h
parent63c6c7e070b9c79d0a797ed50fa90c8f1d35480d (diff)
downloadgcc-49576e25cbab7891bc3296e2bcd84d0c284560a6.zip
gcc-49576e25cbab7891bc3296e2bcd84d0c284560a6.tar.gz
gcc-49576e25cbab7891bc3296e2bcd84d0c284560a6.tar.bz2
configure.ac (gcc_cv_ld_mips_personality_relaxation): New feature check.
gcc/ * configure.ac (gcc_cv_ld_mips_personality_relaxation): New feature check. (HAVE_LD_PERSONALITY_RELAXATION): New macro definition. * configure, config.in: Regenerate. * dwarf2asm.c (eh_data_format_name): Handle DW_EH_PE_indirect | DW_EH_PE_absptr. * config/mips/mips.h (TARGET_WRITABLE_EH_FRAME): New macro. (ASM_PREFERRED_EH_DATA_FORMAT): Define. Use MIPS_EH_INDIRECT for global data if the output could be used in a shared library. * config/mips/mips.c (mips_override_options): Set flag_dwarf2_cfi_asm to 0 if TARGET_WRITABLE_EH_FRAME. From-SVN: r151896
Diffstat (limited to 'gcc/config/mips/mips.h')
-rw-r--r--gcc/config/mips/mips.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 71b9b1b..defcd6e 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -230,6 +230,14 @@ enum mips_code_readable_setting {
&& !TARGET_ABSOLUTE_ABICALLS \
&& !(mips_abi == ABI_64 && TARGET_IRIX))
+/* True if the output must have a writable .eh_frame.
+ See ASM_PREFERRED_EH_DATA_FORMAT for details. */
+#ifdef HAVE_LD_PERSONALITY_RELAXATION
+#define TARGET_WRITABLE_EH_FRAME 0
+#else
+#define TARGET_WRITABLE_EH_FRAME (flag_pic && TARGET_SHARED)
+#endif
+
/* Generate mips16 code */
#define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0)
/* Generate mips16e code. Default 16bit ASE for mips32* and mips64* */
@@ -3182,3 +3190,30 @@ extern enum mips_code_readable_setting mips_code_readable;
/* This is necessary to avoid a warning about comparing different enum
types. */
#define mips_tune_attr ((enum attr_cpu) mips_tune)
+
+/* As on most targets, we want the .eh_frame section to be read-only where
+ possible. And as on most targets, this means two things:
+
+ (a) Non-locally-binding pointers must have an indirect encoding,
+ so that the addresses in the .eh_frame section itself become
+ locally-binding.
+
+ (b) A shared library's .eh_frame section must encode locally-binding
+ pointers in a relative (relocation-free) form.
+
+ However, MIPS has traditionally not allowed directives like:
+
+ .long x-.
+
+ in cases where "x" is in a different section, or is not defined in the
+ same assembly file. We are therefore unable to emit the PC-relative
+ form required by (b) at assembly time.
+
+ Fortunately, the linker is able to convert absolute addresses into
+ PC-relative addresses on our behalf. Unfortunately, only certain
+ versions of the linker know how to do this for indirect pointers,
+ and for personality data. We must fall back on using writable
+ .eh_frame sections for shared libraries if the linker does not
+ support this feature. */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
+ (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr)