/* Linker command language support.
- Copyright 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#include "ldmisc.h"
#include "ldindr.h"
#include "ldctor.h"
+
/* FORWARDS */
static void print_statements PARAMS ((void));
static void print_statement PARAMS ((lang_statement_union_type *,
lang_output_section_statement_type *));
+static lang_statement_union_type *new_statement PARAMS ((enum statement_enum,
+ size_t,
+ lang_statement_list_type*));
+
/* LOCALS */
static struct obstack stat_obstack;
lang_output_section_statement_type *abs_output_section;
lang_statement_list_type *stat_ptr = &statement_list;
lang_input_statement_type *script_file = 0;
-boolean option_longmap = false;
lang_statement_list_type file_chain =
{0};
CONST char *entry_symbol = 0;
/* IMPORTS */
extern char *default_target;
-extern unsigned int undefined_global_sym_count;
extern char *current_file;
extern bfd *output_bfd;
extern enum bfd_architecture ldfile_output_architecture;
extern unsigned int commons_pending;
extern args_type command_line;
extern ld_config_type config;
-extern boolean had_script;
extern boolean write_map;
extern int g_switch_value;
lang_statement_union_type *
new_statement (type, size, list)
enum statement_enum type;
- bfd_size_type size;
+ size_t size;
lang_statement_list_type * list;
{
lang_statement_union_type *new = (lang_statement_union_type *)
{
/* Look it up or build a new one */
lang_has_input_file = true;
+
+ if (name) {
+ if ((*(name+strlen(name)-1) == '.') && (*(name+strlen(name)) == 'a')) {
+ file_type=lang_input_file_is_l_enum;
+ }
+ }
+
#if 0
lang_input_statement_type *p;
{
extern strip_symbols_type strip_symbols;
if (keepsyms_file != 0)
- info ("%X%P error: duplicated keep-symbols-file value\n");
+ info_msg ("%X%P: error: duplicated keep-symbols-file value\n");
keepsyms_file = filename;
if (strip_symbols != STRIP_NONE)
- info ("%P `-keep-only-symbols-file' overrides `-s' and `-S'\n");
+ info_msg ("%P: `-keep-only-symbols-file' overrides `-s' and `-S'\n");
strip_symbols = STRIP_SOME;
}
s->bfd_section = bfd_make_section (output_bfd, s->name);
if (s->bfd_section == (asection *) NULL)
{
- einfo ("%P%F output format %s cannot represent section called %s\n",
+ einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, s->name);
}
s->bfd_section->output_section = s->bfd_section;
{
if (bfd_error == invalid_target)
{
- einfo ("%P%F target %s not found\n", output_target);
+ einfo ("%P%F: target %s not found\n", output_target);
}
- einfo ("%P%F problem opening output file %s, %E\n", name);
+ einfo ("%P%F: cannot open output file %s: %E\n", name);
}
/* output->flags |= D_PAGED;*/
- bfd_set_format (output, bfd_object);
- bfd_set_arch_mach (output,
- ldfile_output_architecture,
- ldfile_output_machine);
+ if (! bfd_set_format (output, bfd_object))
+ einfo ("%P%F:%s: can not make object file: %E\n", name);
+ if (! bfd_set_arch_mach (output,
+ ldfile_output_architecture,
+ ldfile_output_machine))
+ einfo ("%P%F:%s: can not set architecture: %E\n", name);
+
bfd_set_gp_size (output, g_switch_value);
return output;
}
*def_ptr = def;
def->name = ptr->name;
def->section = &bfd_und_section;
- Q_enter_global_ref (def_ptr, ptr->name);
+ enter_global_ref (def_ptr, ptr->name);
ptr = ptr->next;
}
}
os->addr_tree = s->address_statement.address;
if (os->bfd_section == (asection *) NULL)
{
- einfo ("%P%F can't set the address of undefined section %s\n",
+ einfo ("%P%F: cannot set the address of undefined section %s\n",
s->address_statement.section_name);
}
}
fprintf (config.map_file, " ");
print_address (outside_symbol_address (q));
fprintf (config.map_file, " %s", q->name ? q->name : " ");
+ if (q->flags & BSF_WEAK)
+ fprintf (config.map_file, " *weak*");
print_nl ();
}
{
asymbol *q = *p;
- if (bfd_get_section (q) == i && q->flags & BSF_GLOBAL)
+ if (bfd_get_section (q) == i
+ && (q->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
{
print_symbol (q);
}
> os->region->origin + os->region->length)
|| ( os->region->origin > os->region->current ))
{
- einfo ("%X%P: Region %s is full (%B section %s)\n",
+ einfo ("%X%P: region %s is full (%B section %s)\n",
os->region->name,
os->bfd_section->owner,
os->bfd_section->name);
lang_final_phase_enum, dot, &dot);
s->data_statement.value = value.value;
if (value.valid == false)
- einfo ("%F%P: Invalid data statement\n");
+ einfo ("%F%P: invalid data statement\n");
}
switch (s->data_statement.type)
{
}
else
{
- /* Can't find anything reasonable,
+ /* Cannot find anything reasonable,
use the first address in the text section
*/
asection *ts = bfd_get_section_by_name (output_bfd, ".text");
if (ts)
{
if (warn)
- einfo ("%P: Warning, can't find entry symbol %s, defaulting to %V\n",
+ einfo ("%P: warning: cannot find entry symbol %s, defaulting to %V\n",
entry_symbol, ts->vma);
bfd_set_start_address (output_bfd, ts->vma);
else
{
if (warn)
- einfo ("%P: Warning, can't find entry symbol %s, not setting start address\n",
+ einfo ("%P: warning: cannot find entry symbol %s, not setting start address\n",
entry_symbol);
}
}
else
{
- info ("%P: warning, %s architecture of input file `%B' incompatible with %s output\n",
+ info_msg ("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n",
bfd_printable_name (input_bfd), input_bfd,
bfd_printable_name (output_bfd));
- bfd_set_arch_mach (output_bfd,
- input_architecture,
- input_machine);
+ if (! bfd_set_arch_mach (output_bfd,
+ input_architecture,
+ input_machine))
+ einfo ("%P%F:%s: can't set architecture: %E\n",
+ bfd_get_filename (output_bfd));
}
}
name);
/* BFD backend must provide this section. */
if (newsec == (asection *) NULL)
- einfo ("%P%F: No output section %s", name);
+ einfo ("%P%F: no output section %s", name);
com->section = newsec;
}
if (default_common_section ==
(lang_output_section_statement_type *) NULL)
{
- info ("%P: No [COMMON] command, defaulting to .bss\n");
+ info_msg ("%P: no [COMMON] command, defaulting to .bss\n");
default_common_section =
lang_output_section_statement_lookup (".bss");
/* ptr->flag_loadable= state;*/
break;
default:
- einfo ("%P%F illegal syntax in flags\n");
+ einfo ("%P%F: invalid syntax in flags\n");
break;
}
flags++;
def->flags = flags;
def->section = section;
*def_ptr = def;
- Q_enter_global_ref (def_ptr, name);
+ enter_global_ref (def_ptr, name);
return def;
}
void
lang_process ()
{
- if (had_script == false)
- {
- /* Read the emulation's appropriate default script. */
- char *scriptname = ldemul_get_script ();
- size_t size = strlen (scriptname) + 13;
- char *buf = (char *) ldmalloc(size);
-
- sprintf (buf, "-Tldscripts/%s", scriptname);
- parse_line (buf, 0);
- free (buf);
- }
-
lang_reasonable_defaults ();
current_target = default_target;
{
if (startup_file != (char *) NULL)
{
- einfo ("%P%FMultiple STARTUP files\n");
+ einfo ("%P%Fmultiple STARTUP files\n");
}
first_file->filename = name;
first_file->local_sym_name = name;