aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-06-25 01:49:08 +0000
committerAlan Modra <amodra@gmail.com>2012-06-25 01:49:08 +0000
commit47e2e729981c9399ee4a28ec56c0484b2a014f49 (patch)
tree60fa74982105c5b991ea22b2078bdd684efadf35 /ld
parentedcc0ccdfcf6a1eb70772493a38be9d4001fb37e (diff)
downloadgdb-47e2e729981c9399ee4a28ec56c0484b2a014f49.zip
gdb-47e2e729981c9399ee4a28ec56c0484b2a014f49.tar.gz
gdb-47e2e729981c9399ee4a28ec56c0484b2a014f49.tar.bz2
* ldlang.c (load_symbols): Close file and set flags.loaded
after parsing script file. (open_input_bfds): Don't segv on closed script.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 58b6beb..b9b325e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-25 Alan Modra <amodra@gmail.com>
+
+ * ldlang.c (load_symbols): Close file and set flags.loaded
+ after parsing script file.
+ (open_input_bfds): Don't segv on closed script.
+
2012-06-24 H.J. Lu <hongjiu.lu@intel.com>
* configure.tgt: Enable elf_k1om for x86_64-*-linux-gnux32.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index ddf3be2..7dd2fa4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2668,6 +2668,7 @@ load_symbols (lang_input_statement_type *entry,
{
bfd_error_type err;
struct lang_input_statement_flags save_flags;
+ extern FILE *yyin;
err = bfd_get_error ();
@@ -2715,6 +2716,9 @@ load_symbols (lang_input_statement_type *entry,
save_flags.missing_file |= input_flags.missing_file;
input_flags = save_flags;
pop_stat_ptr ();
+ fclose (yyin);
+ yyin = NULL;
+ entry->flags.loaded = TRUE;
return TRUE;
}
@@ -3224,6 +3228,7 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
#endif
&& !s->input_statement.flags.whole_archive
&& s->input_statement.flags.loaded
+ && s->input_statement.the_bfd != NULL
&& bfd_check_format (s->input_statement.the_bfd,
bfd_archive))
s->input_statement.flags.loaded = FALSE;
@@ -3233,6 +3238,7 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
&& plugin_insert == NULL
&& s->input_statement.flags.loaded
&& s->input_statement.flags.add_DT_NEEDED_for_regular
+ && s->input_statement.the_bfd != NULL
&& ((s->input_statement.the_bfd->flags) & DYNAMIC) != 0
&& plugin_should_reload (s->input_statement.the_bfd))
{