@@ -1972,7 +1972,7 @@ cgraph_node::assemble_thunks_and_aliases (void)
FOR_EACH_ALIAS (this, ref)
{
cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (!alias->transparent_alias)
+ if (!alias->transparent_alias && !DECL_EXTERNAL (alias->decl))
{
bool saved_written = TREE_ASM_WRITTEN (decl);
@@ -178,7 +178,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
/* Add all aliases associated with the symbol. */
FOR_EACH_ALIAS (node, ref)
- if (!ref->referring->transparent_alias)
+ if (!ref->referring->transparent_alias
+ && ref->referring->get_partitioning_class () != SYMBOL_EXTERNAL)
add_symbol_to_partition_1 (part, ref->referring);
else
{
@@ -189,7 +190,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
{
/* Nested transparent aliases are not permitted. */
gcc_checking_assert (!ref2->referring->transparent_alias);
- add_symbol_to_partition_1 (part, ref2->referring);
+ if (ref2->referring->get_partitioning_class () != SYMBOL_EXTERNAL)
+ add_symbol_to_partition_1 (part, ref2->referring);
}
}
new file mode 100644
@@ -0,0 +1,13 @@
+/* { dg-lto-do link } */
+
+int _umh(int i)
+{
+ return i+1;
+}
+
+int weaks(int i) __attribute__((weak, alias("_umh")));
+
+int main()
+{
+ return weaks(10);
+}
new file mode 100644
@@ -0,0 +1,6 @@
+/* { dg-options { -fno-lto } } */
+
+int weaks(int i)
+{
+ return i+1;
+}