diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-11-08 22:54:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-11-08 22:54:07 +0000 |
commit | 6a02a973c4ccb78c8a51bffa94030007b510e498 (patch) | |
tree | 68e8ec8b0acdf39d9706bdc2ff9f5ec645e8cbc3 /ld/ldlang.c | |
parent | 5cd1adaba5328d5421b6641ac0a1eba5072b61c0 (diff) | |
download | gdb-6a02a973c4ccb78c8a51bffa94030007b510e498.zip gdb-6a02a973c4ccb78c8a51bffa94030007b510e498.tar.gz gdb-6a02a973c4ccb78c8a51bffa94030007b510e498.tar.bz2 |
* ldlang.c (load_symbols): Add new argument place. Only accept
linker scripts if place is not NULL. Put commands found in an
assumed linker script into place.
(lookup_name): Pass NULL as place argument to load_symbols.
(open_input_bfds): In lang_input_statement_enum case, pass a place
argument to load_symbols, and store any new statements after the
current one.
PR 5917.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 2d8d4a4..9643c28 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -77,7 +77,8 @@ static void wild_section PARAMS ((lang_wild_statement_type *ptr, lang_input_statement_type *file, lang_output_section_statement_type *output)); static lang_input_statement_type *lookup_name PARAMS ((const char *name)); -static void load_symbols PARAMS ((lang_input_statement_type *entry)); +static void load_symbols PARAMS ((lang_input_statement_type *entry, + lang_statement_list_type *)); static void wild PARAMS ((lang_wild_statement_type *s, const char *section, const char *file, const char *target, @@ -737,7 +738,7 @@ lookup_name (name) || search->filename == (const char *) NULL) return search; - load_symbols (search); + load_symbols (search, (lang_statement_list_type *) NULL); return search; } @@ -745,8 +746,9 @@ lookup_name (name) /* Get the symbols for an input file. */ static void -load_symbols (entry) +load_symbols (entry, place) lang_input_statement_type *entry; + lang_statement_list_type *place; { char **matching; @@ -759,6 +761,7 @@ load_symbols (entry) && ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching)) { bfd_error_type err; + lang_statement_list_type *hold; err = bfd_get_error (); if (err == bfd_error_file_ambiguously_recognized) @@ -771,7 +774,8 @@ load_symbols (entry) einfo (" %s", *p); einfo ("%F\n"); } - else if (err != bfd_error_file_not_recognized) + else if (err != bfd_error_file_not_recognized + || place == NULL) einfo ("%F%B: file not recognized: %E\n", entry->the_bfd); /* Try to interpret the file as a linker script. */ @@ -781,11 +785,16 @@ load_symbols (entry) ldfile_open_command_file (entry->filename); + hold = stat_ptr; + stat_ptr = place; + ldfile_assumed_script = true; parser_input = input_script; yyparse (); ldfile_assumed_script = false; + stat_ptr = hold; + return; } @@ -968,6 +977,8 @@ open_input_bfds (s, force) case lang_input_statement_enum: if (s->input_statement.real == true) { + lang_statement_list_type add; + s->input_statement.target = current_target; /* If we are being called from within a group, and this @@ -979,7 +990,15 @@ open_input_bfds (s, force) bfd_archive)) s->input_statement.loaded = false; - load_symbols (&s->input_statement); + lang_list_init (&add); + + load_symbols (&s->input_statement, &add); + + if (add.head != NULL) + { + *add.tail = s->next; + s->next = add.head; + } } break; default: @@ -2901,13 +2920,25 @@ lang_statement_append (list, element, field) } /* Set the output format type. -oformat overrides scripts. */ + void -lang_add_output_format (format, from_script) - CONST char *format; +lang_add_output_format (format, big, little, from_script) + const char *format; + const char *big; + const char *little; int from_script; { if (output_target == NULL || !from_script) - output_target = format; + { + if (command_line.endian == ENDIAN_BIG + && big != NULL) + format = big; + else if (command_line.endian == ENDIAN_LITTLE + && little != NULL) + format = little; + + output_target = format; + } } /* Enter a group. This creates a new lang_group_statement, and sets |