Commit 40af64cc authored by ebotcazou's avatar ebotcazou
Browse files

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.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100742 138bc75d-0d04-0410-961f-82ee72b054a4
parent 395fe6d2
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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. */
......
......@@ -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
......
......@@ -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. */
......
......@@ -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. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment