This is not a complete fix for 17982 but is what we need right now for lto.
I have bootstrapped the patch and I am now testing it. OK for trunk
(lto will get it in the next merge)?
2008-07-21 Rafael Avila de Espindola <espindola@???>
* c-typeck.c (build_external_ref): Don't call assemble_external.
* final.c (output_operand): Call assemble_external.
Cheers,
--
Rafael Avila de Espindola
Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland
Registered in Dublin, Ireland
Registration Number: 368047
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index dafce2a..a47d632 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2191,8 +2191,6 @@ build_external_ref (tree id, int fun, location_t loc)
/* Recursive call does not count as usage. */
if (ref != current_function_decl)
{
- if (!skip_evaluation)
- assemble_external (ref);
TREE_USED (ref) = 1;
}
diff --git a/gcc/final.c b/gcc/final.c
index f27e430..787c43a 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3344,6 +3344,14 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
PRINT_OPERAND (asm_out_file, x, code);
+ if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+ {
+ tree t;
+ x = XEXP (x, 0);
+ t = SYMBOL_REF_DECL (x);
+ if (t)
+ assemble_external (t);
+ }
}
/* Print a memory reference operand for address X