* 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-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.
{
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;
is_vma = *send == '\0';
}
if (!is_vma)
- ldlang_add_undef (entry_symbol.name);
+ ldlang_add_undef (entry_symbol.name, entry_from_cmdline);
}
}
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:
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;
#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;
/* 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"));
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
config.dynamic_link = FALSE;
break;
case 'u':
- ldlang_add_undef (optarg);
+ ldlang_add_undef (optarg, TRUE);
break;
case OPTION_UNIQUE:
if (optarg != NULL)