diff options
author | Cary Coutant <ccoutant@google.com> | 2010-08-23 20:28:24 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-08-23 20:28:24 +0000 |
commit | 9919d93bc70b0ed9bb5991bcf46e4c3ffaa0a3ce (patch) | |
tree | 4d58e30e8ec798bdfd93e875b7aee578ec4aba77 /gold | |
parent | 96f73ba54fb8e863d7c5d2b7cf3678ea6693952a (diff) | |
download | gdb-9919d93bc70b0ed9bb5991bcf46e4c3ffaa0a3ce.zip gdb-9919d93bc70b0ed9bb5991bcf46e4c3ffaa0a3ce.tar.gz gdb-9919d93bc70b0ed9bb5991bcf46e4c3ffaa0a3ce.tar.bz2 |
* archive.cc (Lib_group::add_symbols): Lock object before deleting its
symbols data.
(Lib_group::include_member): Unlock object after deleting its
symbols data.
* testsuite/start_lib_test_3.c: Remove all global symbols to trigger
the bug fixed here.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 9 | ||||
-rw-r--r-- | gold/archive.cc | 13 | ||||
-rw-r--r-- | gold/testsuite/start_lib_test_3.c | 7 |
3 files changed, 20 insertions, 9 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index beea4a3..e2792b2 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,12 @@ +2010-08-23 Cary Coutant <ccoutant@google.com> + + * archive.cc (Lib_group::add_symbols): Lock object before deleting its + symbols data. + (Lib_group::include_member): Unlock object after deleting its + symbols data. + * testsuite/start_lib_test_3.c: Remove all global symbols to trigger + the bug fixed here. + 2010-08-19 Neil Vachharajani <nvachhar@google.com> Cary Coutant <ccoutant@google.com> diff --git a/gold/archive.cc b/gold/archive.cc index 68a674d..dade043 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -1057,7 +1057,14 @@ Lib_group::add_symbols(Symbol_table* symtab, Layout* layout, else { if (member.sd_ != NULL) - delete member.sd_; + { + // The file must be locked in order to destroy the views + // associated with it. + gold_assert(obj != NULL); + obj->lock(this->task_); + delete member.sd_; + obj->unlock(this->task_); + } } this->members_[i] = this->members_.back(); @@ -1096,10 +1103,10 @@ Lib_group::include_member(Symbol_table* symtab, Layout* layout, layout->incremental_inputs()->report_object(obj, NULL); obj->layout(symtab, layout, sd); obj->add_symbols(symtab, sd, layout); - // Unlock the file for the next task. - obj->unlock(this->task_); } delete sd; + // Unlock the file for the next task. + obj->unlock(this->task_); } // Print statistical information to stderr. This is used for --stats. diff --git a/gold/testsuite/start_lib_test_3.c b/gold/testsuite/start_lib_test_3.c index 555eea1..86444e0 100644 --- a/gold/testsuite/start_lib_test_3.c +++ b/gold/testsuite/start_lib_test_3.c @@ -22,9 +22,4 @@ This is a test of the --start-lib and --end-lib options. */ -extern void t3 (void); - -void -t3 (void) -{ -} +static char t3[] = "t3"; |