diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-03 19:01:36 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-03 19:01:36 +0000 |
commit | 20009fe33b0beceee26257744c81d4ab576702c4 (patch) | |
tree | b0e6ce167e689e6afaff218c91b0bafd5549edbd /gcc/cp | |
parent | 8acfe9c66c81d2ac307f57a5a12f077d35079a1d (diff) | |
download | gcc-20009fe33b0beceee26257744c81d4ab576702c4.tar.gz |
PR c++/12909
* mangle.c: Include cgraph.h.
(mangle_decl): If the mangled name will change in a later
ABI version, make the later mangled name an alias.
* method.c (make_alias_for): Copy DECL_ARGUMENTS.
* Make-lang.in (mangle.o): Depend on cgraph.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 33 | ||||
-rw-r--r-- | gcc/cp/method.c | 1 |
4 files changed, 44 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 556c4ac39fc..1b0b72bc6dd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2010-03-03 Jason Merrill <jason@redhat.com> + + PR c++/12909 + * mangle.c: Include cgraph.h. + (mangle_decl): If the mangled name will change in a later + ABI version, make the later mangled name an alias. + * method.c (make_alias_for): Copy DECL_ARGUMENTS. + * Make-lang.in (mangle.o): Depend on cgraph.h. + 2010-03-01 Marco Poletti <poletti.marco@gmail.com> * pt.c (redeclare_class_template): Use error_n and inform_n. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index f6cb70fbeec..1484063fae5 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -308,7 +308,7 @@ cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h $(INTEGRATE_H) \ insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \ $(TARGET_H) tree-iterator.h $(CGRAPH_H) cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h $(REAL_H) \ - gt-cp-mangle.h $(TARGET_H) $(TM_P_H) + gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H) cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) gt-cp-parser.h \ output.h $(TARGET_H) $(PLUGIN_H) intl.h cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) toplev.h $(C_COMMON_H) \ diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 6196ae2edf6..9478092daf6 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "varray.h" #include "flags.h" #include "target.h" +#include "cgraph.h" /* Debugging support. */ @@ -3055,6 +3056,38 @@ mangle_decl (const tree decl) tree id = mangle_decl_string (decl); id = targetm.mangle_decl_assembler_name (decl, id); SET_DECL_ASSEMBLER_NAME (decl, id); + +#ifdef ASM_OUTPUT_DEF + if (G.need_abi_warning) + { + /* If the mangling will change in the future, emit an alias with the + future mangled name for forward-compatibility. */ + int save_ver; + tree id2, alias; + + SET_IDENTIFIER_GLOBAL_VALUE (id, decl); + if (IDENTIFIER_GLOBAL_VALUE (id) != decl) + inform (DECL_SOURCE_LOCATION (decl), "-fabi-version=4 (or =0) " + "avoids this error with a change in vector mangling"); + + if (TREE_CODE (decl) != FUNCTION_DECL) + return; + + save_ver = flag_abi_version; + flag_abi_version = 0; + id2 = mangle_decl_string (decl); + id2 = targetm.mangle_decl_assembler_name (decl, id2); + flag_abi_version = save_ver; + + alias = make_alias_for (decl, id2); + DECL_IGNORED_P (alias) = 1; + TREE_PUBLIC (alias) = TREE_PUBLIC (decl); + DECL_VISIBILITY (alias) = DECL_VISIBILITY (decl); + if (vague_linkage_fn_p (decl)) + DECL_WEAK (alias) = 1; + cgraph_same_body_alias (alias, decl); + } +#endif } /* Generate the mangled representation of TYPE. */ diff --git a/gcc/cp/method.c b/gcc/cp/method.c index ccc977d9df3..c25cedba178 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -234,6 +234,7 @@ make_alias_for (tree function, tree newid) DECL_TEMPLATE_INSTANTIATED (alias) = 0; DECL_TEMPLATE_INFO (alias) = NULL; DECL_INITIAL (alias) = error_mark_node; + DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target)); TREE_ADDRESSABLE (alias) = 1; TREE_USED (alias) = 1; SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias)); |