* ldlang.h (ldlang_add_undef): Add cmdline param.
* ldlang.c (undef_from_cmdline): New var. (ldlang_add_undef): Add cmdline param. Set undef_from_cmdline. (lang_end): Really require -e or -u from command line on relocatable --gc-sections. * ldemul.c (after_parse_default): Adjust ldlang_add_undef call. * ldgram.y (extern_name_list_body): Likewise. * lexsup.c (parse_args): Likewise. * emultempl/aix.em (gld${EMULATION_NAME}_read_file): Likewise.
This commit is contained in:
parent
47f929815c
commit
24898b7032
7 changed files with 25 additions and 12 deletions
12
ld/ChangeLog
12
ld/ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-10-28 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* ldlang.h (ldlang_add_undef): Add cmdline param.
|
||||
* ldlang.c (undef_from_cmdline): New var.
|
||||
(ldlang_add_undef): Add cmdline param. Set undef_from_cmdline.
|
||||
(lang_end): Really require -e or -u from command line on
|
||||
relocatable --gc-sections.
|
||||
* ldemul.c (after_parse_default): Adjust ldlang_add_undef call.
|
||||
* ldgram.y (extern_name_list_body): Likewise.
|
||||
* lexsup.c (parse_args): Likewise.
|
||||
* emultempl/aix.em (gld${EMULATION_NAME}_read_file): Likewise.
|
||||
|
||||
2010-10-25 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* plugin.c (plugin_get_ir_dummy_bfd): Set bfd_use_reserved_id.
|
||||
|
|
|
@ -1193,7 +1193,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import)
|
|||
{
|
||||
struct export_symbol_list *n;
|
||||
|
||||
ldlang_add_undef (symname);
|
||||
ldlang_add_undef (symname, TRUE);
|
||||
n = ((struct export_symbol_list *)
|
||||
xmalloc (sizeof (struct export_symbol_list)));
|
||||
n->next = export_symbols;
|
||||
|
|
|
@ -219,7 +219,7 @@ after_parse_default (void)
|
|||
is_vma = *send == '\0';
|
||||
}
|
||||
if (!is_vma)
|
||||
ldlang_add_undef (entry_symbol.name);
|
||||
ldlang_add_undef (entry_symbol.name, entry_from_cmdline);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,11 +287,11 @@ extern_name_list:
|
|||
|
||||
extern_name_list_body:
|
||||
NAME
|
||||
{ ldlang_add_undef ($1); }
|
||||
{ ldlang_add_undef ($1, FALSE); }
|
||||
| extern_name_list_body NAME
|
||||
{ ldlang_add_undef ($2); }
|
||||
{ ldlang_add_undef ($2, FALSE); }
|
||||
| extern_name_list_body ',' NAME
|
||||
{ ldlang_add_undef ($3); }
|
||||
{ ldlang_add_undef ($3, FALSE); }
|
||||
;
|
||||
|
||||
script_file:
|
||||
|
|
11
ld/ldlang.c
11
ld/ldlang.c
|
@ -101,6 +101,7 @@ lang_statement_list_type input_file_chain;
|
|||
struct bfd_sym_chain entry_symbol = { NULL, NULL };
|
||||
const char *entry_section = ".text";
|
||||
bfd_boolean entry_from_cmdline;
|
||||
bfd_boolean undef_from_cmdline;
|
||||
bfd_boolean lang_has_input_file = FALSE;
|
||||
bfd_boolean had_output_filename = FALSE;
|
||||
bfd_boolean lang_float_flag = FALSE;
|
||||
|
@ -3297,11 +3298,12 @@ typedef struct bfd_sym_chain ldlang_undef_chain_list_type;
|
|||
#define ldlang_undef_chain_list_head entry_symbol.next
|
||||
|
||||
void
|
||||
ldlang_add_undef (const char *const name)
|
||||
ldlang_add_undef (const char *const name, bfd_boolean cmdline)
|
||||
{
|
||||
ldlang_undef_chain_list_type *new_undef = (ldlang_undef_chain_list_type *)
|
||||
stat_alloc (sizeof (ldlang_undef_chain_list_type));
|
||||
ldlang_undef_chain_list_type *new_undef;
|
||||
|
||||
undef_from_cmdline = undef_from_cmdline || cmdline;
|
||||
new_undef = (ldlang_undef_chain_list_type *) stat_alloc (sizeof (*new_undef));
|
||||
new_undef->next = ldlang_undef_chain_list_head;
|
||||
ldlang_undef_chain_list_head = new_undef;
|
||||
|
||||
|
@ -5583,8 +5585,7 @@ lang_end (void)
|
|||
/* Force the user to specify a root when generating a relocatable with
|
||||
--gc-sections. */
|
||||
if (link_info.gc_sections && link_info.relocatable
|
||||
&& (entry_symbol.name == NULL
|
||||
&& ldlang_undef_chain_list_head == NULL))
|
||||
&& !(entry_from_cmdline || undef_from_cmdline))
|
||||
einfo (_("%P%F: gc-sections requires either an entry or "
|
||||
"an undefined symbol\n"));
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ extern lang_output_section_statement_type *lang_output_section_statement_lookup
|
|||
extern lang_output_section_statement_type *next_matching_output_section_statement
|
||||
(lang_output_section_statement_type *, int);
|
||||
extern void ldlang_add_undef
|
||||
(const char *const);
|
||||
(const char *const, bfd_boolean);
|
||||
extern void lang_add_output_format
|
||||
(const char *, const char *, const char *, int);
|
||||
extern void lang_list_init
|
||||
|
|
|
@ -1307,7 +1307,7 @@ parse_args (unsigned argc, char **argv)
|
|||
config.dynamic_link = FALSE;
|
||||
break;
|
||||
case 'u':
|
||||
ldlang_add_undef (optarg);
|
||||
ldlang_add_undef (optarg, TRUE);
|
||||
break;
|
||||
case OPTION_UNIQUE:
|
||||
if (optarg != NULL)
|
||||
|
|
Loading…
Reference in a new issue