From: Cary Coutant Date: Tue, 21 Jul 2015 19:42:07 +0000 (-0700) Subject: Fix internal error when linking an archive library with no preceding objects. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb5cf5e26ea2e42937a2ce1b662e61e4772ba6f9;p=binutils-gdb.git Fix internal error when linking an archive library with no preceding objects. gold/ PR gold/18696 * archive.cc (Library_base::should_include_member): Don't use entry point for relocatable links, or if target is not yet valid. * parameters.cc (Parameters::entry): Check target_valid(). --- diff --git a/gold/ChangeLog b/gold/ChangeLog index becff516c75..b7f0a33500b 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2015-07-21 Cary Coutant + + PR gold/18696 + * archive.cc (Library_base::should_include_member): Don't use entry + point for relocatable links, or if target is not yet valid. + * parameters.cc (Parameters::entry): Check target_valid(). + 2015-07-20 Han Shen Optimize erratum 843419 fix. diff --git a/gold/archive.cc b/gold/archive.cc index 6d259803185..cc69c40fb98 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -138,11 +138,15 @@ Library_base::should_include_member(Symbol_table* symtab, Layout* layout, return Library_base::SHOULD_INCLUDE_YES; } - if (strcmp(sym_name, parameters->entry()) == 0) + if (!parameters->options().relocatable()) { - *why = "entry symbol "; - *why += sym_name; - return Library_base::SHOULD_INCLUDE_YES; + const char* entry_sym = parameters->entry(); + if (entry_sym != NULL && strcmp(sym_name, entry_sym) == 0) + { + *why = "entry symbol "; + *why += sym_name; + return Library_base::SHOULD_INCLUDE_YES; + } } return Library_base::SHOULD_INCLUDE_UNKNOWN; diff --git a/gold/parameters.cc b/gold/parameters.cc index 8eab000cf52..5ed19122512 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -237,7 +237,7 @@ const char* Parameters::entry() const { const char* ret = this->options().entry(); - if (ret == NULL) + if (ret == NULL && parameters->target_valid()) ret = parameters->target().entry_symbol_name(); return ret; }