aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-08-11 10:14:54 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-08-11 08:14:54 +0000
commita8b522b483ebb8c972ecfde8779a7a6ec16aecd6 (patch)
tree9758313b56edfd190549a5e205c9576068fe786e /gcc/cp
parent4c71a171edb5e21a89a08643abfe933a43bb5d6d (diff)
downloadgcc-a8b522b483ebb8c972ecfde8779a7a6ec16aecd6.zip
gcc-a8b522b483ebb8c972ecfde8779a7a6ec16aecd6.tar.gz
gcc-a8b522b483ebb8c972ecfde8779a7a6ec16aecd6.tar.bz2
Introduce TARGET_SUPPORTS_ALIASES
2017-08-11 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_post_options): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. 2017-08-11 Martin Liska <mliska@suse.cz> * asan.c (asan_protect_global): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. * cgraph.c (cgraph_node::create_same_body_alias): Likewise. * ipa-visibility.c (can_replace_by_local_alias): Likewise. (optimize_weakref): Likewise. * symtab.c (symtab_node::noninterposable_alias): Likewise. * varpool.c (varpool_node::create_extra_name_alias): Likewise. * defaults.h: Introduce TARGET_SUPPORTS_ALIASES. 2017-08-11 Martin Liska <mliska@suse.cz> * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. (handle_tls_init): Likewise. (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for both arguments. * optimize.c (can_alias_cdtor): Likewise. From-SVN: r251048
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl2.c25
-rw-r--r--gcc/cp/optimize.c6
3 files changed, 23 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0115f68..a8a3fcc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2017-08-11 Martin Liska <mliska@suse.cz>
+
+ * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
+ TARGET_SUPPORTS_ALIASES.
+ (handle_tls_init): Likewise.
+ (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
+ both arguments.
+ * optimize.c (can_alias_cdtor): Likewise.
+
2017-08-11 Jason Merrill <jason@redhat.com>
PR c++/81671 - nullptr_t template parameter
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 8187ab9..37393a1 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3156,11 +3156,9 @@ get_tls_init_fn (tree var)
if (!flag_extern_tls_init && DECL_EXTERNAL (var))
return NULL_TREE;
-#ifdef ASM_OUTPUT_DEF
/* If the variable is internal, or if we can't generate aliases,
call the local init function directly. */
- if (!TREE_PUBLIC (var))
-#endif
+ if (!TREE_PUBLIC (var) || !TARGET_SUPPORTS_ALIASES)
return get_local_tls_init_fn ();
tree sname = mangle_tls_init_fn (var);
@@ -4241,9 +4239,8 @@ handle_tls_init (void)
tree init = TREE_PURPOSE (vars);
one_static_initialization_or_destruction (var, init, true);
-#ifdef ASM_OUTPUT_DEF
/* Output init aliases even with -fno-extern-tls-init. */
- if (TREE_PUBLIC (var))
+ if (TARGET_SUPPORTS_ALIASES && TREE_PUBLIC (var))
{
tree single_init_fn = get_tls_init_fn (var);
if (single_init_fn == NULL_TREE)
@@ -4253,7 +4250,6 @@ handle_tls_init (void)
(single_init_fn, fn);
gcc_assert (alias != NULL);
}
-#endif
}
finish_then_clause (if_stmt);
@@ -4298,17 +4294,18 @@ generate_mangling_alias (tree decl, tree id2)
implementation. */
void
-note_mangling_alias (tree decl ATTRIBUTE_UNUSED, tree id2 ATTRIBUTE_UNUSED)
+note_mangling_alias (tree decl, tree id2)
{
-#ifdef ASM_OUTPUT_DEF
- if (!defer_mangling_aliases)
- generate_mangling_alias (decl, id2);
- else
+ if (TARGET_SUPPORTS_ALIASES)
{
- vec_safe_push (mangling_aliases, decl);
- vec_safe_push (mangling_aliases, id2);
+ if (!defer_mangling_aliases)
+ generate_mangling_alias (decl, id2);
+ else
+ {
+ vec_safe_push (mangling_aliases, decl);
+ vec_safe_push (mangling_aliases, id2);
+ }
}
-#endif
}
/* Emit all mangling aliases that were deferred up to this point. */
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index a1c3870..09ffbda 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -184,10 +184,10 @@ cdtor_comdat_group (tree complete, tree base)
static bool
can_alias_cdtor (tree fn)
{
-#ifndef ASM_OUTPUT_DEF
/* If aliases aren't supported by the assembler, fail. */
- return false;
-#endif
+ if (!TARGET_SUPPORTS_ALIASES)
+ return false;
+
/* We can't use an alias if there are virtual bases. */
if (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn)))
return false;