re PR target/77957 (Undefined .LCTOC0 with -fstack-protector-strong -mminimal-toc -O0 on ppc64)

PR target/77957
	* hooks.h (hook_tree_void_null): Declare.
	* hooks.c (hook_tree_void_null): New function.
	* langhooks.c (lhd_return_null_tree_v): Remove.
	* langhooks-def.h (lhd_return_null_tree_v): Remove.
	* cfgexpand.c (stack_protect_prologue): If guard_decl is NULL,
	set y to const0_rtx.
	* function.c (stack_protect_epilogue): Likewise.
	* config/tilepro/tilepro.c (TARGET_STACK_PROTECT_GUARD): Redefine
	if TARGET_THREAD_SSP_OFFSET is defined.
	* config/s390/s390.c (TARGET_STACK_PROTECT_GUARD): Likewise.
	* config/sparc/sparc.c (TARGET_STACK_PROTECT_GUARD): Likewise.
	* config/tilegx/tilegx.c (TARGET_STACK_PROTECT_GUARD): Likewise.
	* config/rs6000/rs6000.c (TARGET_STACK_PROTECT_GUARD): Likewise.
	* config/i386/i386.c (TARGET_STACK_PROTECT_GUARD): Likewise.
	(ix86_stack_protect_guard): New function.
c/
	* c-objc-common.h (LANG_HOOKS_GETDECLS): Use hook_tree_void_null
	instead of lhd_return_null_tree_v.
ada/
	* gcc-interface/misc.c (LANG_HOOKS_GETDECLS): Use hook_tree_void_null
	instead of lhd_return_null_tree_v.

From-SVN: r241087
This commit is contained in:
Jakub Jelinek 2016-10-13 10:29:03 +02:00 committed by Jakub Jelinek
parent 90bca4ed80
commit 1202f33e5e
17 changed files with 91 additions and 13 deletions

View File

@ -1,3 +1,22 @@
2016-10-13 Jakub Jelinek <jakub@redhat.com>
PR target/77957
* hooks.h (hook_tree_void_null): Declare.
* hooks.c (hook_tree_void_null): New function.
* langhooks.c (lhd_return_null_tree_v): Remove.
* langhooks-def.h (lhd_return_null_tree_v): Remove.
* cfgexpand.c (stack_protect_prologue): If guard_decl is NULL,
set y to const0_rtx.
* function.c (stack_protect_epilogue): Likewise.
* config/tilepro/tilepro.c (TARGET_STACK_PROTECT_GUARD): Redefine
if TARGET_THREAD_SSP_OFFSET is defined.
* config/s390/s390.c (TARGET_STACK_PROTECT_GUARD): Likewise.
* config/sparc/sparc.c (TARGET_STACK_PROTECT_GUARD): Likewise.
* config/tilegx/tilegx.c (TARGET_STACK_PROTECT_GUARD): Likewise.
* config/rs6000/rs6000.c (TARGET_STACK_PROTECT_GUARD): Likewise.
* config/i386/i386.c (TARGET_STACK_PROTECT_GUARD): Likewise.
(ix86_stack_protect_guard): New function.
2016-10-13 Richard Biener <rguenther@suse.de>
* dwarf2out.c (tree_add_const_value_attribute): Do not try

View File

@ -1,3 +1,9 @@
2016-10-13 Jakub Jelinek <jakub@redhat.com>
PR target/77957
* gcc-interface/misc.c (LANG_HOOKS_GETDECLS): Use hook_tree_void_null
instead of lhd_return_null_tree_v.
2016-10-12 Yannick Moy <moy@adacore.com>
* einfo.adb, einfo.ads (Partial_Refinement_Constituents): Take

View File

@ -1366,7 +1366,7 @@ get_lang_specific (tree node)
#undef LANG_HOOKS_TYPE_HASH_EQ
#define LANG_HOOKS_TYPE_HASH_EQ gnat_type_hash_eq
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#define LANG_HOOKS_GETDECLS hook_tree_void_null
#undef LANG_HOOKS_PUSHDECL
#define LANG_HOOKS_PUSHDECL gnat_return_tree
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL

View File

@ -1,3 +1,9 @@
2016-10-13 Jakub Jelinek <jakub@redhat.com>
PR target/77957
* c-objc-common.h (LANG_HOOKS_GETDECLS): Use hook_tree_void_null
instead of lhd_return_null_tree_v.
2016-10-07 Bernd Schmidt <bschmidt@redhat.com>
PR c++/69733

View File

@ -91,7 +91,7 @@ along with GCC; see the file COPYING3. If not see
This means it must also provide its own write_globals. */
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#define LANG_HOOKS_GETDECLS hook_tree_void_null
/* Hooks for tree gimplification. */
#undef LANG_HOOKS_GIMPLIFY_EXPR

View File

@ -6100,7 +6100,10 @@ stack_protect_prologue (void)
rtx x, y;
x = expand_normal (crtl->stack_protect_guard);
y = expand_normal (guard_decl);
if (guard_decl)
y = expand_normal (guard_decl);
else
y = const0_rtx;
/* Allow the target to copy from Y to X without leaking Y into a
register. */

View File

@ -44023,6 +44023,18 @@ ix86_mangle_type (const_tree type)
}
}
#ifdef TARGET_THREAD_SSP_OFFSET
/* If using TLS guards, don't waste time creating and expanding
__stack_chk_guard decl and MEM as we are going to ignore it. */
static tree
ix86_stack_protect_guard (void)
{
if (TARGET_SSP_TLS_GUARD)
return NULL_TREE;
return default_stack_protect_guard ();
}
#endif
/* For 32-bit code we can save PIC register setup by using
__stack_chk_fail_local hidden function instead of calling
__stack_chk_fail directly. 64-bit code doesn't need to setup any PIC
@ -50614,6 +50626,11 @@ ix86_addr_space_zero_address_valid (addr_space_t as)
#undef TARGET_MANGLE_TYPE
#define TARGET_MANGLE_TYPE ix86_mangle_type
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD ix86_stack_protect_guard
#endif
#if !TARGET_MACHO
#undef TARGET_STACK_PROTECT_FAIL
#define TARGET_STACK_PROTECT_FAIL ix86_stack_protect_fail

View File

@ -1752,6 +1752,11 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION \
rs6000_builtin_md_vectorized_function
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
#endif
#if !TARGET_MACHO
#undef TARGET_STACK_PROTECT_FAIL
#define TARGET_STACK_PROTECT_FAIL rs6000_stack_protect_fail

View File

@ -15124,6 +15124,11 @@ s390_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, const_tree ty
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE s390_option_override
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
#endif
#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO s390_encode_section_info

View File

@ -798,6 +798,11 @@ char sparc_hard_reg_printed[8];
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE sparc_option_override
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
#endif
#if TARGET_GNU_TLS && defined(HAVE_AS_SPARC_UA_PCREL)
#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
#define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel

View File

@ -5544,6 +5544,11 @@ tilegx_file_end (void)
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE tilegx_option_override
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
#endif
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P tilegx_scalar_mode_supported_p

View File

@ -4948,6 +4948,11 @@ tilepro_file_end (void)
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE tilepro_option_override
#ifdef TARGET_THREAD_SSP_OFFSET
#undef TARGET_STACK_PROTECT_GUARD
#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
#endif
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P tilepro_scalar_mode_supported_p

View File

@ -5058,7 +5058,10 @@ stack_protect_epilogue (void)
rtx_insn *seq;
x = expand_normal (crtl->stack_protect_guard);
y = expand_normal (guard_decl);
if (guard_decl)
y = expand_normal (guard_decl);
else
y = const0_rtx;
/* Allow the target to compare Y with X without leaking either into
a register. */

View File

@ -429,6 +429,13 @@ hook_tree_const_tree_null (const_tree)
return NULL;
}
/* Generic hook that takes no arguments and returns a NULL_TREE. */
tree
hook_tree_void_null (void)
{
return NULL;
}
/* Generic hook that takes a rtx_insn * and an int and returns a bool. */
bool

View File

@ -89,6 +89,7 @@ extern int hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t,
bool);
extern tree hook_tree_const_tree_null (const_tree);
extern tree hook_tree_void_null (void);
extern tree hook_tree_tree_tree_null (tree, tree);
extern tree hook_tree_tree_tree_tree_null (tree, tree, tree);

View File

@ -41,7 +41,6 @@ extern void lhd_do_nothing_f (struct function *);
extern tree lhd_pass_through_t (tree);
extern bool lhd_post_options (const char **);
extern alias_set_type lhd_get_alias_set (tree);
extern tree lhd_return_null_tree_v (void);
extern tree lhd_return_null_tree (tree);
extern tree lhd_return_null_const_tree (const_tree);
extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);

View File

@ -76,14 +76,6 @@ lhd_do_nothing_f (struct function * ARG_UNUSED (f))
/* Do nothing (return NULL_TREE). */
tree
lhd_return_null_tree_v (void)
{
return NULL_TREE;
}
/* Do nothing (return NULL_TREE). */
tree
lhd_return_null_tree (tree ARG_UNUSED (t))
{