re PR debug/21889 (Native Solaris assembler cannot grok DTP-relative debug symbols)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Wed, 8 Jun 2005 05:05:45 +0000 (07:05 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 8 Jun 2005 05:05:45 +0000 (05:05 +0000)
PR target/21889
* target.h (gcc_target) <asm_out>: New field output_dwarf_dtprel.
* target-def.h (TARGET_ASM_OUTPUT_DWARF_DTPREL): New macro.
(TARGET_ASM_OUT): Add it.
* doc/tm.texi (Debugging Info): Document it.
* dwarf2out.c (output_loc_operands) <INTERNAL_DW_OP_tls_addr>:
Test it instead of ASM_OUTPUT_DWARF_DTPREL.
(loc_descriptor_from_tree_1) <VAR_DECL>: Likewise.
* system.h: Poison ASM_OUTPUT_DWARF_DTPREL.
* config/frv/frv-protos.h (frv_output_dwarf_dtprel): Delete.
* config/frv/frv.c (frv_output_dwarf_dtprel): Make static and unused.
(gen_inlined_tls_plt): Remove unused variable MEM.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to frv_output_dwarf_dtprel.
* config/frv/frv.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
* config/i386/i386-protos.h (i386_output_dwarf_dtprel): Delete.
* config/i386/i386.c (i386_output_dwarf_dtprel): Make static and
unused.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to i386_output_dwarf_dtprel.
* config/i386/i386.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
* config/ia64/ia64-protos.h (ia64_output_dwarf_dtprel): Delete.
* config/ia64/ia64.c (ia64_output_dwarf_dtprel): Make static and
unused.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to ia64_output_dwarf_dtprel.
* config/ia64/ia64.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
* config/rs6000/rs6000-protos.h (rs6000_output_dwarf_dtprel): Delete.
* config/rs6000/rs6000.c (rs6000_output_dwarf_dtprel): Make static and
unused.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to rs6000_output_dwarf_dtprel
* config/rs6000/rs6000.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
* config/s390/s390-protos.h (s390_output_dwarf_dtprel): Delete.
* config/s390/s390.c (s390_output_dwarf_dtprel): Make static and
unused.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to s390_output_dwarf_dtprel.
* config/s390/s390.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
* config/sparc/sol2-gas.h (TARGET_SUN_TLS): Define to 0.
(TARGET_GNU_TLS): Define to 1.
* config/sparc/sparc-protos.h (sparc_output_dwarf_dtprel): Delete.
* config/sparc/sparc.c (sparc_output_dwarf_dtprel): Make static and
unused.
(TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to sparc_output_dwarf_dtprel
if TARGET_GNU_TLS only.
* config/sparc/sparc.h (ASM_OUTPUT_DWARF_DTPREL): Delete.

* config.gcc (sparc64-*-solaris2*): Include tm-dwarf2.h last.
(sparc-*-solaris2*): Likewise on Solaris 7 and up.

From-SVN: r100742

27 files changed:
gcc/ChangeLog
gcc/config.gcc
gcc/config/frv/frv-protos.h
gcc/config/frv/frv.c
gcc/config/frv/frv.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/ia64/ia64-protos.h
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h
gcc/config/sparc/sol2-gas.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sparc-protos.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h
gcc/doc/tm.texi
gcc/dwarf2out.c
gcc/system.h
gcc/target-def.h
gcc/target.h

index 1c446b209b4375e838ccbf64f9c3cf4866810162..246e3daaabe30cff0b6da222f95b4ea42308cedc 100644 (file)
@@ -1,3 +1,51 @@
+2005-06-08  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR target/21889
+       * target.h (gcc_target) <asm_out>: New field output_dwarf_dtprel.
+       * target-def.h (TARGET_ASM_OUTPUT_DWARF_DTPREL): New macro.
+       (TARGET_ASM_OUT): Add it.
+       * doc/tm.texi (Debugging Info): Document it.
+       * dwarf2out.c (output_loc_operands) <INTERNAL_DW_OP_tls_addr>:
+       Test it instead of ASM_OUTPUT_DWARF_DTPREL.
+       (loc_descriptor_from_tree_1) <VAR_DECL>: Likewise.
+       * system.h: Poison ASM_OUTPUT_DWARF_DTPREL.
+       * config/frv/frv-protos.h (frv_output_dwarf_dtprel): Delete.
+       * config/frv/frv.c (frv_output_dwarf_dtprel): Make static and unused.
+       (gen_inlined_tls_plt): Remove unused variable MEM.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to frv_output_dwarf_dtprel.
+       * config/frv/frv.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+       * config/i386/i386-protos.h (i386_output_dwarf_dtprel): Delete.
+       * config/i386/i386.c (i386_output_dwarf_dtprel): Make static and
+       unused.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to i386_output_dwarf_dtprel.
+       * config/i386/i386.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+       * config/ia64/ia64-protos.h (ia64_output_dwarf_dtprel): Delete.
+       * config/ia64/ia64.c (ia64_output_dwarf_dtprel): Make static and
+       unused.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to ia64_output_dwarf_dtprel.
+       * config/ia64/ia64.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+       * config/rs6000/rs6000-protos.h (rs6000_output_dwarf_dtprel): Delete.
+       * config/rs6000/rs6000.c (rs6000_output_dwarf_dtprel): Make static and
+       unused.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to rs6000_output_dwarf_dtprel
+       * config/rs6000/rs6000.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+       * config/s390/s390-protos.h (s390_output_dwarf_dtprel): Delete.
+       * config/s390/s390.c (s390_output_dwarf_dtprel): Make static and
+       unused.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to s390_output_dwarf_dtprel.
+       * config/s390/s390.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+       * config/sparc/sol2-gas.h (TARGET_SUN_TLS): Define to 0.
+       (TARGET_GNU_TLS): Define to 1.
+       * config/sparc/sparc-protos.h (sparc_output_dwarf_dtprel): Delete.
+       * config/sparc/sparc.c (sparc_output_dwarf_dtprel): Make static and
+       unused.
+       (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define to sparc_output_dwarf_dtprel
+       if TARGET_GNU_TLS only.
+       * config/sparc/sparc.h (ASM_OUTPUT_DWARF_DTPREL): Delete.
+
+       * config.gcc (sparc64-*-solaris2*): Include tm-dwarf2.h last.
+       (sparc-*-solaris2*): Likewise on Solaris 7 and up.
+
 2005-06-07  Dale Johannesen  <dalej@apple.com>
 
        * config/i386/i386.md (movqi_1):  Fix case where source
index 7eab07281fa6c49bfa08a1a91712927aa26fdd2b..6cf2c8cf79729706fe88a7291dcb818c7d20ed9f 100644 (file)
@@ -2021,13 +2021,14 @@ sparc-*-rtems*)
        extra_parts="crti.o crtn.o crtbegin.o crtend.o"
        ;;
 sparc64-*-solaris2* | sparcv9-*-solaris2*)
-       tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/sol2-64.h sparc/sol2-bi.h tm-dwarf2.h"
+       tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/sol2-64.h sparc/sol2-bi.h"
        if test x$gnu_ld = xyes; then
                tm_file="${tm_file} sparc/sol2-gld.h sparc/sol2-gld-bi.h"
        fi
        if test x$gas = xyes; then
                tm_file="${tm_file} sparc/sol2-gas.h sparc/sol2-gas-bi.h"
        fi
+       tm_file="${tm_file} tm-dwarf2.h"
        tmake_file="t-sol2 sparc/t-sol2 sparc/t-sol2-64 sparc/t-crtfm"
        if test x$gnu_ld = xyes; then
                tmake_file="$tmake_file t-slibgcc-elf-ver"
@@ -2071,13 +2072,14 @@ sparc-*-solaris2*)
                fi
                ;;
        *-*-solaris2.[789] | *-*-solaris2.1[0-9]*)
-               tm_file="sparc/biarch64.h ${tm_file} sparc/sol2-bi.h tm-dwarf2.h"
+               tm_file="sparc/biarch64.h ${tm_file} sparc/sol2-bi.h"
                if test x$gnu_ld = xyes; then
                        tm_file="${tm_file} sparc/sol2-gld-bi.h"
                fi
                if test x$gas = xyes; then
                        tm_file="${tm_file} sparc/sol2-gas-bi.h"
                fi
+               tm_file="${tm_file} tm-dwarf2.h"
                tmake_file="$tmake_file sparc/t-sol2-64"
                need_64bit_hwint=yes
                ;;
index 89107a022edce8761728bd5c20d6536910a2b0cd..a6f6dc480d5f6163af825e292ff09fe875b35bd1 100644 (file)
@@ -204,7 +204,6 @@ extern int accg_operand                     (rtx, enum machine_mode);
 extern rtx frv_matching_accg_for_acc   (rtx);
 extern void frv_expand_fdpic_call      (rtx *, bool, bool);
 extern rtx frv_gen_GPsym2reg           (rtx, rtx);
-extern void frv_output_dwarf_dtprel    (FILE *, int, rtx);
 extern int frv_legitimate_memory_operand (rtx, enum machine_mode, int);
 
 /* Information about a relocation unspec.  SYMBOL is the relocation symbol
index cc9270c88bbcba739df767ebbefadeca7f898dc6..b54c085858dea85f6cb92759f4e38b525d28407b 100644 (file)
@@ -353,6 +353,8 @@ static rtx frv_struct_value_rtx                     (tree, int);
 static bool frv_must_pass_in_stack (enum machine_mode mode, tree type);
 static int frv_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
                                  tree, bool);
+static void frv_output_dwarf_dtprel            (FILE *, int, rtx)
+  ATTRIBUTE_UNUSED;
 \f
 /* Allow us to easily change the default for -malloc-cc.  */
 #ifndef DEFAULT_NO_ALLOC_CC
@@ -426,6 +428,11 @@ static int frv_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG frv_reorg
 
+#if HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL frv_output_dwarf_dtprel
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #define FRV_SYMBOL_REF_TLS_P(RTX) \
@@ -3415,7 +3422,7 @@ frv_legitimate_address_p (enum machine_mode mode,
 static rtx
 gen_inlined_tls_plt (rtx addr)
 {
-  rtx mem, retval, dest;
+  rtx retval, dest;
   rtx picreg = get_hard_reg_initial_val (Pmode, FDPIC_REG);
 
 
@@ -9098,10 +9105,10 @@ frv_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
 
 #define TLS_BIAS (2048 - 16)
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void
 frv_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   gcc_assert (size == 4);
index fa9cca0e9a507e15171917a192cc7459debd856d..6f2c22d861a9a51abbc7b2a7daa38b1792a672cb 100644 (file)
@@ -2361,13 +2361,6 @@ do {                                                                     \
   assemble_name (STREAM, LABEL);                                       \
 } while (0)
 
-#if HAVE_AS_TLS
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  frv_output_dwarf_dtprel ((FILE), (SIZE), (X))
-#endif
-
 /* Whether to emit the gas specific dwarf2 line number support.  */
 #define DWARF2_ASM_LINE_DEBUG_INFO (TARGET_DEBUG_LOC)
 \f
index df107d36190ae663d0c08ab42b1414166542b373..142eb5ab1debcf5ebaca6737e8c755255558d46a 100644 (file)
@@ -120,8 +120,6 @@ extern const char *output_387_reg_move (rtx, rtx*);
 extern const char *output_fix_trunc (rtx, rtx*, int);
 extern const char *output_fp_compare (rtx, rtx*, int, int);
 
-extern void i386_output_dwarf_dtprel (FILE*, int, rtx);
-
 extern void ix86_expand_clear (rtx);
 extern void ix86_expand_move (enum machine_mode, rtx[]);
 extern void ix86_expand_vector_move (enum machine_mode, rtx[]);
index f24a5cc7995ad5e7589714d74d6d379301e018b0..80170f90de87f6e315dd23ea0a9615aa3fedb2ec 100644 (file)
@@ -866,6 +866,8 @@ static int ix86_address_cost (rtx);
 static bool ix86_cannot_force_const_mem (rtx);
 static rtx ix86_delegitimize_address (rtx);
 
+static void i386_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
+
 struct builtin_description;
 static rtx ix86_expand_sse_comi (const struct builtin_description *,
                                 tree, rtx);
@@ -1061,6 +1063,11 @@ static void init_ext_80387_constants (void);
 #undef TARGET_VECTOR_MODE_SUPPORTED_P
 #define TARGET_VECTOR_MODE_SUPPORTED_P ix86_vector_mode_supported_p
 
+#ifdef HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL i386_output_dwarf_dtprel
+#endif
+
 #ifdef SUBTARGET_INSERT_ATTRIBUTES
 #undef TARGET_INSERT_ATTRIBUTES
 #define TARGET_INSERT_ATTRIBUTES SUBTARGET_INSERT_ATTRIBUTES
@@ -6107,10 +6114,10 @@ output_pic_addr_const (FILE *file, rtx x, int code)
     }
 }
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void
 i386_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   fputs (ASM_LONG, file);
index 73ad10857335a79da2bdeffe388fac8f7b83537f..c9c4cfc84268aca832cfa8f138829ae2fb970c8c 100644 (file)
@@ -2071,13 +2071,6 @@ do {                                                                     \
 #define JUMP_TABLES_IN_TEXT_SECTION \
   (!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
 
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#ifdef HAVE_AS_TLS
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  i386_output_dwarf_dtprel (FILE, SIZE, X)
-#endif
-
 /* Switch to init or fini section via SECTION_OP, emit a call to FUNC,
    and switch back.  For x86 we do this only to save a few bytes that
    would otherwise be unused in the text section.  */
index 94fa176f7e7857f4c85838e0fe7257badb0d16aa..31b854ce475cfadbd8f9090426eeb74174577f8f 100644 (file)
@@ -68,7 +68,6 @@ extern void ia64_print_operand (FILE *, rtx, int);
 extern enum reg_class ia64_preferred_reload_class (rtx, enum reg_class);
 extern enum reg_class ia64_secondary_reload_class (enum reg_class,
                                                   enum machine_mode, rtx);
-extern void ia64_output_dwarf_dtprel (FILE*, int, rtx);
 extern void process_for_unwind_directive (FILE *, rtx);
 extern const char *get_bundle_name (int);
 #endif /* RTX_CODE */
index e119ecb2b1a83c089732cc3684def021f311de6a..ca4723e006fdf3882b750f232383b245d20191e7 100644 (file)
@@ -232,6 +232,8 @@ static void ia64_file_start (void);
 
 static void ia64_select_rtx_section (enum machine_mode, rtx,
                                     unsigned HOST_WIDE_INT);
+static void ia64_output_dwarf_dtprel (FILE *, int, rtx)
+     ATTRIBUTE_UNUSED;
 static void ia64_rwreloc_select_section (tree, int, unsigned HOST_WIDE_INT)
      ATTRIBUTE_UNUSED;
 static void ia64_rwreloc_unique_section (tree, int)
@@ -369,6 +371,11 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef  TARGET_SECTION_TYPE_FLAGS
 #define TARGET_SECTION_TYPE_FLAGS  ia64_section_type_flags
 
+#ifdef HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL ia64_output_dwarf_dtprel
+#endif
+
 /* ??? ABI doesn't allow us to define this.  */
 #if 0
 #undef TARGET_PROMOTE_FUNCTION_ARGS
@@ -4151,10 +4158,10 @@ ia64_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
     }
 }
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void
 ia64_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   gcc_assert (size == 8);
index 427c17a61a95d007020bfdf513f353a46959e773..3bef0d3a93700ebd80ae087d45cd346a3923a660 100644 (file)
@@ -1733,13 +1733,6 @@ do {                                                                     \
   { "loc79", LOC_REG (79) },                                           \
 }
 
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#ifdef HAVE_AS_TLS
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  ia64_output_dwarf_dtprel (FILE, SIZE, X)
-#endif
-
 /* A C compound statement to output to stdio stream STREAM the assembler syntax
    for an instruction operand X.  X is an RTL expression.  */
 
index 041169bde81e5ed2144439606df20366e027e51c..c67f559ef7281ae1095394eebdb6d10aa4661136 100644 (file)
@@ -153,7 +153,6 @@ extern int rs6000_register_move_cost (enum machine_mode,
                                      enum reg_class, enum reg_class);
 extern int rs6000_memory_move_cost (enum machine_mode, enum reg_class, int);
 extern bool rs6000_tls_referenced_p (rtx);
-extern void rs6000_output_dwarf_dtprel (FILE*, int, rtx);
 extern int rs6000_hard_regno_nregs (int, enum machine_mode);
 extern void rs6000_conditional_register_usage (void);
 
index 6a55de112db456d1bdbea280cf6bc9023570fa2f..7bee8c0eb3c5c28d9e8a82f84d7de3c49502e78c 100644 (file)
@@ -683,6 +683,7 @@ int easy_vector_constant (rtx, enum machine_mode);
 static bool rs6000_is_opaque_type (tree);
 static rtx rs6000_dwarf_register_span (rtx);
 static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
+static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
 static rtx rs6000_tls_get_addr (void);
 static rtx rs6000_got_sym (void);
 static int rs6000_tls_symbol_ref_1 (rtx *, void *);
@@ -982,6 +983,11 @@ static const char alt_reg_names[][8] =
 #undef TARGET_RELAXED_ORDERING
 #define TARGET_RELAXED_ORDERING true
 
+#ifdef HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL rs6000_output_dwarf_dtprel
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 
@@ -2730,10 +2736,10 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
     return NULL_RTX;
 }
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void
 rs6000_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   switch (size)
index 2710dad4dae60e9ac4a5bfc8d9b3b5e9c7f6acf4..39474ac050e0954f1bbc91eda76573e12bcbb553 100644 (file)
 
 #define TARGET_32BIT           (! TARGET_64BIT)
 
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#ifdef HAVE_AS_TLS
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  rs6000_output_dwarf_dtprel (FILE, SIZE, X)
-#endif
-
 #ifndef HAVE_AS_TLS
 #define HAVE_AS_TLS 0
 #endif
index 3d3ca0cc3e539f415e117d68e60965bdf0167c99..1d470a24a3909cce1fa7f10953675d8f9b7d7e9d 100644 (file)
@@ -88,7 +88,6 @@ extern void s390_output_pool_entry (rtx, enum machine_mode, unsigned int);
 extern void s390_trampoline_template (FILE *);
 extern void s390_initialize_trampoline (rtx, rtx, rtx);
 extern rtx s390_gen_rtx_const_DI (int, int);
-extern void s390_output_dwarf_dtprel (FILE*, int, rtx);
 extern int s390_agen_dep_p (rtx, rtx);
 extern rtx s390_load_got (void);
 extern void s390_emit_tpf_eh_return (rtx);
index 54661eddbc6f8f826bdd008b86d5fd74979e4bae..5b82a8e92b3e480ea1e0d4932edfa7e1901ef4bb 100644 (file)
@@ -3561,10 +3561,12 @@ s390_expand_addcc (enum rtx_code cmp_code, rtx cmp_op0, rtx cmp_op1,
 }
 
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void s390_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
+
+static void
 s390_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   switch (size)
@@ -8285,6 +8287,11 @@ s390_reorg (void)
 #undef TARGET_INSN_VALID_WITHIN_DOLOOP
 #define TARGET_INSN_VALID_WITHIN_DOLOOP hook_bool_rtx_true
 
+#ifdef HAVE_AS_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL s390_output_dwarf_dtprel
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-s390.h"
index f04f1387f48fad475034d4cfa2b1c45294fba0b1..1141d3b2e969cc6ab59840e232fb327ffffcfad9 100644 (file)
@@ -918,13 +918,6 @@ extern int flag_pic;
   "%ap",  "%cc",  "%fp",  "%rp",  "%a0",  "%a1"                                \
 }
 
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#ifdef HAVE_AS_TLS
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  s390_output_dwarf_dtprel (FILE, SIZE, X)
-#endif
-
 /* Print operand X (an rtx) in assembler syntax to file FILE.  */
 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
index 7e808f7acaf3feb50c006c346fe9cf9694118455..942e39de8a457fadadab0f8256ceefa68325a116 100644 (file)
@@ -3,3 +3,11 @@
 
 /* Undefine this so that BNSYM/ENSYM pairs are emitted by STABS+.  */
 #undef NO_DBX_BNSYM_ENSYM
+
+/* Use GNU extensions to TLS support.  */
+#ifdef HAVE_AS_TLS
+#undef TARGET_SUN_TLS
+#undef TARGET_GNU_TLS
+#define TARGET_SUN_TLS 0
+#define TARGET_GNU_TLS 1
+#endif
index 1c68133a8c947ab1434932b78dfa21d15aca5698..9b548c2d34cfd35da358564892de0e9c154f5b53 100644 (file)
@@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA.  */
 
 #undef  ASM_GENERATE_INTERNAL_LABEL
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)  \
-  sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+  sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM))
 
 /* The native TLS-enabled assembler requires the directive #tls_object
    to be put on objects in TLS sections (as of v7.1).  This is not
index 9c6e822cc766c091be24b44073af645f3264906c..c743f55c000328ce07aa5246d5a1412028e51980 100644 (file)
@@ -114,7 +114,6 @@ extern int v9_regcmp_p (enum rtx_code);
 extern int sparc_check_64 (rtx, rtx);
 extern rtx gen_df_reg (rtx, int);
 extern int sparc_extra_constraint_check (rtx, int, int);
-extern void sparc_output_dwarf_dtprel (FILE*, int, rtx);
 #endif /* RTX_CODE */
 
 #endif /* __SPARC_PROTOS_H__ */
index 9d5edd183913bb48bfc0b7bb18b38906d8a435a4..314895536db689157839f2a6fc7c963a910ae0cb 100644 (file)
@@ -363,6 +363,7 @@ static bool sparc_pass_by_reference (CUMULATIVE_ARGS *,
 static int sparc_arg_partial_bytes (CUMULATIVE_ARGS *,
                                    enum machine_mode, tree, bool);
 static void sparc_dwarf_handle_frame_unspec (const char *, rtx, int);
+static void sparc_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
 static void sparc_file_end (void);
 #ifdef SUBTARGET_ATTRIBUTE_TABLE
 const struct attribute_spec sparc_attribute_table[];
@@ -437,10 +438,11 @@ static bool fpu_option_set = false;
 #undef TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN sparc_expand_builtin
 
-#ifdef HAVE_AS_TLS
+#if TARGET_TLS
 #undef TARGET_HAVE_TLS
 #define TARGET_HAVE_TLS true
 #endif
+
 #undef TARGET_CANNOT_FORCE_CONST_MEM
 #define TARGET_CANNOT_FORCE_CONST_MEM sparc_cannot_force_const_mem
 
@@ -512,6 +514,11 @@ static bool fpu_option_set = false;
 #undef TARGET_HANDLE_OPTION
 #define TARGET_HANDLE_OPTION sparc_handle_option
 
+#if TARGET_GNU_TLS
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel
+#endif
+
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END sparc_file_end
 
@@ -8451,10 +8458,10 @@ sparc_dwarf_handle_frame_unspec (const char *label,
   dwarf2out_window_save (label);
 }
 
-/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
+/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
    We need to emit DTP-relative relocations.  */
 
-void
+static void
 sparc_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   switch (size)
@@ -8472,8 +8479,10 @@ sparc_output_dwarf_dtprel (FILE *file, int size, rtx x)
   fputs (")", file);
 }
 
-static
-void sparc_file_end (void)
+/* Do whatever processing is required at the end of a file.  */
+
+static void
+sparc_file_end (void)
 {
   /* If we haven't emitted the special PIC helper function, do so now.  */
   if (pic_helper_symbol_name[0] && !pic_helper_emitted_p)
index aa3752c9d6f4c0655f3100979e34f3305f92f430..73a64ca9463968bdf007f80684473a3e7bc8e36c 100644 (file)
@@ -2349,13 +2349,6 @@ extern int sparc_indent_opcode;
       }                                        \
   } while (0)
 
-/* Emit a dtp-relative reference to a TLS variable.  */
-
-#ifdef HAVE_AS_TLS
-#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-  sparc_output_dwarf_dtprel (FILE, SIZE, X)
-#endif
-
 #define SPARC_SYMBOL_REF_TLS_P(RTX) \
   (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0)
 
@@ -2447,11 +2440,14 @@ extern int sparc_indent_opcode;
     }                                                          \
 }
 
+/* TLS support defaulting to original Sun flavor.  GNU extensions
+   must be activated in separate configuration files.  */
 #ifdef HAVE_AS_TLS
 #define TARGET_TLS 1
 #else
 #define TARGET_TLS 0
 #endif
+
 #define TARGET_SUN_TLS TARGET_TLS
 #define TARGET_GNU_TLS 0
 
index a4adcb9db55b0ebe5d0ead87c011d23ef5e22bc3..427a23ed5802b750cf753413012bb2b277442442 100644 (file)
@@ -8140,6 +8140,11 @@ A C statement to issue assembly directives that create a self-relative
 reference to the given label, using an integer of the given size.
 @end defmac
 
+@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{FILE}, int @var{size}, rtx @var{x})
+If defined, this target hook is a function which outputs a DTP-relative
+reference to the given TLS symbol of the specified size.
+@end deftypefn
+
 @defmac PUT_SDB_@dots{}
 Define these macros to override the assembler syntax for the special
 SDB assembler directives.  See @file{sdbout.c} for a list of these
index e11cd806376605c64616f8bb3839ad89b7e2d5af..bbd2b32bc5a45d48048632760f420a9feec607a8 100644 (file)
@@ -3284,13 +3284,15 @@ output_loc_operands (dw_loc_descr_ref loc)
       break;
 
     case INTERNAL_DW_OP_tls_addr:
-#ifdef ASM_OUTPUT_DWARF_DTPREL
-      ASM_OUTPUT_DWARF_DTPREL (asm_out_file, DWARF2_ADDR_SIZE,
-                              val1->v.val_addr);
-      fputc ('\n', asm_out_file);
-#else
-      gcc_unreachable ();
-#endif
+      if (targetm.asm_out.output_dwarf_dtprel)
+       {
+         targetm.asm_out.output_dwarf_dtprel (asm_out_file,
+                                              DWARF2_ADDR_SIZE,
+                                              val1->v.val_addr);
+         fputc ('\n', asm_out_file);
+       }
+      else
+       gcc_unreachable ();
       break;
 
     default:
@@ -8954,10 +8956,9 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
        {
          rtx rtl;
 
-#ifndef ASM_OUTPUT_DWARF_DTPREL
          /* If this is not defined, we have no way to emit the data.  */
-         return 0;
-#endif
+         if (!targetm.asm_out.output_dwarf_dtprel)
+           return 0;
 
          /* The way DW_OP_GNU_push_tls_address is specified, we can only
             look up addresses of objects in the current module.  */
index 43455b96edb658eee6162d410c587ded428baef0..9969356b3addc925e46606e51e201a341c2ee1b9 100644 (file)
@@ -692,7 +692,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
        HANDLE_PRAGMA_REDEFINE_EXTNAME HANDLE_PRAGMA_EXTERN_PREFIX      \
        MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE               \
         VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN                         \
-       FUNCTION_ARG_PARTIAL_NREGS
+       FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
index f5d98f95e09018b3a82f7458edd641018729b274..7d71aeafc4c1f9c7af2010148c8bc9ceec4fea61 100644 (file)
@@ -191,6 +191,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_ASM_MARK_DECL_PRESERVED hook_void_constcharptr
 #endif
 
+#ifndef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL NULL
+#endif
+
 #define TARGET_ASM_ALIGNED_INT_OP                              \
                       {TARGET_ASM_ALIGNED_HI_OP,               \
                        TARGET_ASM_ALIGNED_SI_OP,               \
@@ -232,7 +236,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                         TARGET_ASM_FILE_START,                  \
                         TARGET_ASM_FILE_END,                   \
                        TARGET_ASM_EXTERNAL_LIBCALL,            \
-                        TARGET_ASM_MARK_DECL_PRESERVED}
+                        TARGET_ASM_MARK_DECL_PRESERVED,                \
+                       TARGET_ASM_OUTPUT_DWARF_DTPREL}
 
 /* Scheduler hooks.  All of these default to null pointers, which
    haifa-sched.c looks for and handles.  */
index 1527819d916fe66aad719187e3ceebf1d84373fa..0cdd82d034da40ba4f906c892bc9a3808d98a824 100644 (file)
@@ -180,6 +180,9 @@ struct gcc_target
        linker to not dead code strip this symbol.  */
     void (*mark_decl_preserved) (const char *);
 
+    /* Output a DTP-relative reference to a TLS symbol.  */
+    void (*output_dwarf_dtprel) (FILE *file, int size, rtx x);
+
   } asm_out;
 
   /* Functions relating to instruction scheduling.  */