aboutsummaryrefslogtreecommitdiff
path: root/gold/archive.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2015-07-21 12:42:07 -0700
committerCary Coutant <ccoutant@gmail.com>2015-07-21 12:42:07 -0700
commitcb5cf5e26ea2e42937a2ce1b662e61e4772ba6f9 (patch)
tree4ed81d81fa24984156a4cf11d54d4b5dbb42dd00 /gold/archive.cc
parentaf1b22f3004774f8c5c570abe7fab629026032f7 (diff)
downloadgdb-cb5cf5e26ea2e42937a2ce1b662e61e4772ba6f9.zip
gdb-cb5cf5e26ea2e42937a2ce1b662e61e4772ba6f9.tar.gz
gdb-cb5cf5e26ea2e42937a2ce1b662e61e4772ba6f9.tar.bz2
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().
Diffstat (limited to 'gold/archive.cc')
-rw-r--r--gold/archive.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index 6d25980..cc69c40 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;