This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR target/21889


Hi,

The native Solaris SPARC assembler cannot grok the r_tls_dtpoff symbol emitted 
for DTP-relative relocations in the DWARF-2 debug output (e.g. on Solaris 10 
where the assembler is TLS-enabled by default).  This patch fixes that by 
turning ASM_OUTPUT_DWARF_DTPREL into a target hook that can be selectively 
disabled in assembler-specific configuration files.

Bootstrapped/regtested on x86_64-suse-linux, tested on sparc-sun-solaris2.10 
and with cross-compilers to the affected architectures.  OK for mainline?

I'd like to have it fixed on 4.0 and 3.4 branches as well, because it is quite 
annoying.  Of course no big patch here, only a zero-risk kludge, tested on 
Solaris 2.5.1 up to Solaris 10.  OK for both branches?


4.1:
2005-06-06  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): Remove.

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


4.0:
2005-06-06  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR target/21889
	* config/sparc/sol2.h (ASM_OUTPUT_DWARF_DTPREL): Undefine.
	* config/sparc/sol2-gas.h (ASM_OUTPUT_DWARF_DTPREL): Redefine.


3.4:
2005-06-06  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR target/21889
	* config/sparc/sol2.h (ASM_OUTPUT_DWARF_DTPREL): Undefine.
	* config/sparc/sol2-gas-bi.h (ASM_OUTPUT_DWARF_DTPREL): Redefine.


Testsuite:
2005-06-06  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.dg/tls/debug-1.c: New test.

	
-- 
Eric Botcazou
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.547
diff -u -r1.547 config.gcc
--- config.gcc	1 Jun 2005 00:29:42 -0000	1.547
+++ config.gcc	5 Jun 2005 11:33:29 -0000
@@ -2016,13 +2016,14 @@
 	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"
@@ -2066,13 +2067,14 @@
 		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: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.596
diff -u -r1.596 dwarf2out.c
--- dwarf2out.c	1 Jun 2005 00:39:38 -0000	1.596
+++ dwarf2out.c	5 Jun 2005 11:33:32 -0000
@@ -3262,13 +3262,15 @@
       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:
@@ -8939,10 +8941,9 @@
 	{
 	  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: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.123
diff -u -r1.123 target-def.h
--- target-def.h	31 May 2005 15:51:37 -0000	1.123
+++ target-def.h	5 Jun 2005 11:33:33 -0000
@@ -191,6 +191,10 @@
 #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 @@
                         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: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.135
diff -u -r1.135 target.h
--- target.h	31 May 2005 15:51:37 -0000	1.135
+++ target.h	5 Jun 2005 11:33:33 -0000
@@ -180,6 +180,9 @@
 	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.  */
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.431
diff -u -r1.431 tm.texi
--- doc/tm.texi	1 Jun 2005 07:02:36 -0000	1.431
+++ doc/tm.texi	5 Jun 2005 11:33:36 -0000
@@ -8140,6 +8140,11 @@
 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: system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.256
diff -u -r1.256 system.h
--- system.h	1 Jun 2005 07:02:17 -0000	1.256
+++ system.h	6 Jun 2005 14:33:38 -0000
@@ -692,7 +692,7 @@
 	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: config/frv/frv-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv-protos.h,v
retrieving revision 1.26
diff -u -r1.26 frv-protos.h
--- config/frv/frv-protos.h	4 Apr 2005 21:53:22 -0000	1.26
+++ config/frv/frv-protos.h	5 Jun 2005 11:33:36 -0000
@@ -204,7 +204,6 @@
 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: config/frv/frv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.c,v
retrieving revision 1.89
diff -u -r1.89 frv.c
--- config/frv/frv.c	26 May 2005 18:14:54 -0000	1.89
+++ config/frv/frv.c	5 Jun 2005 11:33:38 -0000
@@ -353,6 +353,8 @@
 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;
 
 /* Allow us to easily change the default for -malloc-cc.  */
 #ifndef DEFAULT_NO_ALLOC_CC
@@ -426,6 +428,11 @@
 #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 @@
 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 @@
 
 #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: config/frv/frv.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.h,v
retrieving revision 1.63
diff -u -r1.63 frv.h
--- config/frv/frv.h	4 Apr 2005 21:53:22 -0000	1.63
+++ config/frv/frv.h	5 Jun 2005 11:33:40 -0000
@@ -2372,13 +2372,6 @@
   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)
 
Index: config/i386/i386-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386-protos.h,v
retrieving revision 1.138
diff -u -r1.138 i386-protos.h
--- config/i386/i386-protos.h	24 Apr 2005 07:59:17 -0000	1.138
+++ config/i386/i386-protos.h	5 Jun 2005 11:33:40 -0000
@@ -120,8 +120,6 @@
 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: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.823
diff -u -r1.823 i386.c
--- config/i386/i386.c	26 May 2005 18:14:55 -0000	1.823
+++ config/i386/i386.c	5 Jun 2005 11:33:43 -0000
@@ -868,6 +868,8 @@
 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);
@@ -1063,6 +1065,11 @@
 #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
@@ -6109,10 +6116,10 @@
     }
 }
 
-/* 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: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.434
diff -u -r1.434 i386.h
--- config/i386/i386.h	26 May 2005 05:27:44 -0000	1.434
+++ config/i386/i386.h	5 Jun 2005 11:33:44 -0000
@@ -2072,13 +2072,6 @@
 #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: config/ia64/ia64-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64-protos.h,v
retrieving revision 1.72
diff -u -r1.72 ia64-protos.h
--- config/ia64/ia64-protos.h	11 May 2005 21:34:18 -0000	1.72
+++ config/ia64/ia64-protos.h	5 Jun 2005 11:33:44 -0000
@@ -68,7 +68,6 @@
 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: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.369
diff -u -r1.369 ia64.c
--- config/ia64/ia64.c	1 Jun 2005 07:02:19 -0000	1.369
+++ config/ia64/ia64.c	5 Jun 2005 11:33:46 -0000
@@ -232,6 +232,8 @@
 
 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 @@
 #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 @@
     }
 }
 
-/* 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: config/ia64/ia64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.h,v
retrieving revision 1.199
diff -u -r1.199 ia64.h
--- config/ia64/ia64.h	26 May 2005 05:27:48 -0000	1.199
+++ config/ia64/ia64.h	5 Jun 2005 11:33:46 -0000
@@ -1735,13 +1735,6 @@
   { "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: config/rs6000/rs6000-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000-protos.h,v
retrieving revision 1.99
diff -u -r1.99 rs6000-protos.h
--- config/rs6000/rs6000-protos.h	21 Apr 2005 21:13:36 -0000	1.99
+++ config/rs6000/rs6000-protos.h	5 Jun 2005 11:33:46 -0000
@@ -151,7 +151,6 @@
 				      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: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.831
diff -u -r1.831 rs6000.c
--- config/rs6000/rs6000.c	3 Jun 2005 17:18:04 -0000	1.831
+++ config/rs6000/rs6000.c	5 Jun 2005 11:33:50 -0000
@@ -682,6 +682,7 @@
 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 *);
@@ -981,6 +982,11 @@
 #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;
 
 
@@ -2729,10 +2735,10 @@
     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: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.367
diff -u -r1.367 rs6000.h
--- config/rs6000/rs6000.h	1 Jun 2005 00:30:16 -0000	1.367
+++ config/rs6000/rs6000.h	5 Jun 2005 11:33:51 -0000
@@ -150,13 +150,6 @@
 
 #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: config/s390/s390-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390-protos.h,v
retrieving revision 1.70
diff -u -r1.70 s390-protos.h
--- config/s390/s390-protos.h	10 May 2005 20:43:34 -0000	1.70
+++ config/s390/s390-protos.h	5 Jun 2005 11:33:51 -0000
@@ -88,7 +88,6 @@
 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: config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.234
diff -u -r1.234 s390.c
--- config/s390/s390.c	2 Jun 2005 19:57:24 -0000	1.234
+++ config/s390/s390.c	5 Jun 2005 11:33:53 -0000
@@ -3546,10 +3546,12 @@
 }
 
 
-/* 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)
@@ -8270,6 +8272,11 @@
 #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: config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.138
diff -u -r1.138 s390.h
--- config/s390/s390.h	10 May 2005 20:43:36 -0000	1.138
+++ config/s390/s390.h	5 Jun 2005 11:33:53 -0000
@@ -918,13 +918,6 @@
   "%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: config/sparc/sol2-gas.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-gas.h,v
retrieving revision 1.1
diff -u -r1.1 sol2-gas.h
--- config/sparc/sol2-gas.h	24 Sep 2004 06:17:07 -0000	1.1
+++ config/sparc/sol2-gas.h	5 Jun 2005 11:33:53 -0000
@@ -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: config/sparc/sparc-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc-protos.h,v
retrieving revision 1.53
diff -u -r1.53 sparc-protos.h
--- config/sparc/sparc-protos.h	27 May 2005 00:14:08 -0000	1.53
+++ config/sparc/sparc-protos.h	5 Jun 2005 11:33:53 -0000
@@ -114,7 +114,6 @@
 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: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.375
diff -u -r1.375 sparc.c
--- config/sparc/sparc.c	26 May 2005 18:15:17 -0000	1.375
+++ config/sparc/sparc.c	5 Jun 2005 11:33:55 -0000
@@ -363,6 +363,7 @@
 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 @@
 #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 @@
 #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 @@
   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 @@
   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: config/sparc/sparc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.h,v
retrieving revision 1.285
diff -u -r1.285 sparc.h
--- config/sparc/sparc.h	26 May 2005 05:28:00 -0000	1.285
+++ config/sparc/sparc.h	5 Jun 2005 11:33:56 -0000
@@ -2349,13 +2349,6 @@
       }					\
   } 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 @@
     }								\
 }
 
+/* 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: config/sparc/sol2-gas.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-gas.h,v
retrieving revision 1.1
diff -u -r1.1 sol2-gas.h
--- config/sparc/sol2-gas.h	24 Sep 2004 06:17:07 -0000	1.1
+++ config/sparc/sol2-gas.h	6 Jun 2005 06:31:37 -0000
@@ -3,3 +3,9 @@
 
 /* Undefine this so that BNSYM/ENSYM pairs are emitted by STABS+.  */
 #undef NO_DBX_BNSYM_ENSYM
+
+/* 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
Index: config/sparc/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2.h,v
retrieving revision 1.69.8.1
diff -u -r1.69.8.1 sol2.h
--- config/sparc/sol2.h	18 May 2005 08:03:26 -0000	1.69.8.1
+++ config/sparc/sol2.h	6 Jun 2005 06:31:37 -0000
@@ -104,6 +104,13 @@
 /* The Solaris assembler cannot grok .stabd directives.  */
 #undef NO_DBX_BNSYM_ENSYM
 #define NO_DBX_BNSYM_ENSYM 1
+
+/* The Solaris assembler cannot grok r_tls_dtpoff.  This is
+   a kludge as ASM_OUTPUT_DWARF_DTPREL is defined in sparc.h,
+   undefined here and defined again in sol2-gas.h.  */
+#ifdef HAVE_AS_TLS
+#undef ASM_OUTPUT_DWARF_DTPREL
+#endif
 
 
 #undef  ENDFILE_SPEC
Index: config/sparc/sol2-gas-bi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-gas-bi.h,v
retrieving revision 1.4
diff -u -r1.4 sol2-gas-bi.h
--- config/sparc/sol2-gas-bi.h	17 Jun 2003 01:00:43 -0000	1.4
+++ config/sparc/sol2-gas-bi.h	6 Jun 2005 06:41:52 -0000
@@ -3,3 +3,9 @@
 
 #undef  AS_SPARC64_FLAG
 #define AS_SPARC64_FLAG	"-TSO -64 -Av9"
+
+/* 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
Index: config/sparc/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2.h,v
retrieving revision 1.57.4.4
diff -u -r1.57.4.4 sol2.h
--- config/sparc/sol2.h	1 Apr 2004 16:13:07 -0000	1.57.4.4
+++ config/sparc/sol2.h	6 Jun 2005 06:41:52 -0000
@@ -113,6 +113,12 @@
     }								\
   while (0)
 
+/* The Solaris assembler cannot grok r_tls_dtpoff.  This is
+   a kludge as ASM_OUTPUT_DWARF_DTPREL is defined in sparc.h,
+   undefined here and defined again in sol2-gas-bi.h.  */
+#ifdef HAVE_AS_TLS
+#undef ASM_OUTPUT_DWARF_DTPREL
+#endif
 
 
 #undef  ENDFILE_SPEC
/* { dg-do assemble } */
/* { dg-options "-g" } */

__thread int i;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]