* lto-streamer.h (LTO_tags): Add LTO_var_decl_alias.
* lto-streamer-in.c (lto_input_tree): Read it.
* lto-streamer-out.c (output_unreferenced_globals): Write it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157204
138bc75d-0d04-0410-961f-
82ee72b054a4
* varpool.c (varpool_extra_name_alias): New.
(varpool_assemble_decl): Emit extra name aliases.
(varpool_mark_needed_node): Look past an extra name alias.
+ * lto-streamer.h (LTO_tags): Add LTO_var_decl_alias.
+ * lto-streamer-in.c (lto_input_tree): Read it.
+ * lto-streamer-out.c (output_unreferenced_globals): Write it.
2010-03-03 Eric Botcazou <ebotcazou@adacore.com>
the code and class. */
result = lto_get_builtin_tree (ib, data_in);
}
+ else if (tag == LTO_var_decl_alias)
+ {
+ /* An extra_name alias for a variable. */
+ unsigned HOST_WIDE_INT ix;
+ tree target;
+ ix = lto_input_uleb128 (ib);
+ result = lto_file_decl_data_get_var_decl (data_in->file_data, ix);
+ ix = lto_input_uleb128 (ib);
+ target = lto_file_decl_data_get_var_decl (data_in->file_data, ix);
+ varpool_extra_name_alias (result, target);
+ }
else if (tag == lto_tree_code_to_tag (INTEGER_CST))
{
/* For integer constants we only need the type and its hi/low
if (TREE_CODE (var) == VAR_DECL)
{
+ struct varpool_node *alias;
+
/* Output the object in order to output references used in the
initialization. */
lto_output_tree (ob, var, true);
/* If it is public we also need a reference to the object itself. */
if (TREE_PUBLIC (var))
lto_output_tree_ref (ob, var);
+
+ /* Also output any extra_name aliases for this variable. */
+ for (alias = vnode->extra_name; alias; alias = alias->next)
+ {
+ lto_output_tree (ob, alias->decl, true);
+ output_record_start (ob, LTO_var_decl_alias);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream,
+ alias->decl);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream,
+ var);
+ }
}
}
/* Special for global streamer. Reference to previously-streamed node. */
LTO_tree_pickle_reference,
+ /* A decl which exists only to provide an extra symbol for another var. */
+ LTO_var_decl_alias,
+
/* References to indexable tree nodes. These objects are stored in
tables that are written separately from the function bodies that
reference them. This way they can be instantiated even when the
PR c++/12909
* g++.dg/abi/mangle40.C: New.
* g++.dg/abi/mangle41.C: New.
+ * g++.dg/lto/20100302_0.C: New.
+ * g++.dg/lto/20100302_1.C: New.
+ * g++.dg/lto/20100302.h: New.
2010-03-03 Paul Thomas <pault@gcc.gnu.org>
--- /dev/null
+typedef float mm128 __attribute ((vector_size (16)));
+
+template <class T>
+struct A
+{
+ static T t;
+};
+
+void f (mm128 *);
--- /dev/null
+// Test for ABI forward-compatibility aliases with LTO.
+// { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } }
+// { dg-lto-options {"-flto -fabi-version=2"} }
+
+#include "20100302.h"
+
+void f(mm128 *) { }
+
+template <> mm128 A<mm128>::t = { };
--- /dev/null
+// { dg-options "-fabi-version=0" }
+
+#include "20100302.h"
+
+int main()
+{
+ f(& A<mm128>::t);
+}