From fa72205cb90527fd34753203993859907a53ead2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 20 Jan 2014 21:28:42 +1030 Subject: Allow self-assignment for absolute symbols defined in a linker script Modifies ld machinery tracking linker script assignments to notice all assignments, not just those symbols mentioned in DEFINED(). ld/ PR ld/14962 * ldlang.h (struct lang_definedness_hash_entry): Add by_object and by_script. Make iteration a single bit field. (lang_track_definedness, lang_symbol_definition_iteration): Delete. (lang_symbol_defined): Declare. * ldlang.c (lang_statement_iteration): Expand comment a little. (lang_init ): Make it bigger. (lang_track_definedness, lang_symbol_definition): Delete. (lang_definedness_newfunc): Update. (lang_symbol_defined): New function. (lang_update_definedness): Create entries here. Do track whether script definition of symbol is valid, even when also defined in an object file. * ldexp.c (fold_name ): Update. (fold_name ): Allow self-assignment for absolute symbols defined in a linker script. ld/testsuite/ * ld-scripts/pr14962-2.d, * ld-scripts/pr14962-2.t: New test. * ld-scripts/expr.exp: Run it. --- ld/ldlang.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ld/ldlang.h') diff --git a/ld/ldlang.h b/ld/ldlang.h index e91153c..8c815c6 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -465,7 +465,9 @@ struct unique_sections struct lang_definedness_hash_entry { struct bfd_hash_entry root; - int iteration; + unsigned int by_object : 1; + unsigned int by_script : 1; + unsigned int iteration : 1; }; /* Used by place_orphan to keep track of orphan sections and statements. */ @@ -658,8 +660,7 @@ extern void lang_add_unique (const char *); extern const char *lang_get_output_target (void); -extern void lang_track_definedness (const char *); -extern int lang_symbol_definition_iteration (const char *); +extern struct lang_definedness_hash_entry *lang_symbol_defined (const char *); extern void lang_update_definedness (const char *, struct bfd_link_hash_entry *); -- cgit v1.1