* ldcref.c: Fix formatting.
* ldctor.c: Likewise.
* ldemul.c: Likewise.
* ldexp.c: Likewise.
* ldfile.c: Likewise.
* ldlang.c: Likewise.
+2000-09-29 Kazu Hirata <kazu@hxi.com>
+
+ * ldcref.c: Fix formatting.
+ * ldctor.c: Likewise.
+ * ldemul.c: Likewise.
+ * ldexp.c: Likewise.
+ * ldfile.c: Likewise.
+ * ldlang.c: Likewise.
+
2000-09-28 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
* pe-dll.c (process_def_file): Uninitialized data wasn't
/* Add a symbol to the cref hash table. This is called for every
symbol that is seen during the link. */
-/*ARGSUSED*/
void
add_cref (name, abfd, section, value)
const char *name;
len = strlen (msg);
while (len < FILECOL)
{
- putc (' ' , fp);
+ putc (' ', fp);
++len;
}
fprintf (fp, _("File\n"));
/* Check one symbol to see if it is a prohibited cross reference. */
-/*ARGSUSED*/
static boolean
check_nocrossref (h, ignore)
struct cref_hash_entry *h;
/* ldctor.c -- constructor support routines
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 2000
Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
-
+
This file is part of GLD, the Gnu Linker.
GLD is free software; you can redistribute it and/or modify
{
if (p->reloc != reloc)
{
- einfo (_("%P%X: Different relocs used in set %s\n"), h->root.string);
+ einfo (_("%P%X: Different relocs used in set %s\n"),
+ h->root.string);
return;
}
while (*name == '_')
++name;
- if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0)
+ if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0)
return -1;
name += sizeof "GLOBAL_" - 1;
minfo ("%G\n", e->section->owner, e->section, e->value);
}
- /* Need SEC_KEEP for --gc-sections */
+ /* Need SEC_KEEP for --gc-sections. */
if (! bfd_is_abs_section (e->section))
e->section->flags |= SEC_KEEP;
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GLD; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with GLD; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
ld_emulation_xfer_type *ld_emulation;
void
-ldemul_hll(name)
+ldemul_hll (name)
char *name;
{
- ld_emulation->hll(name);
+ ld_emulation->hll (name);
}
-
-void ldemul_syslib(name)
+void
+ldemul_syslib (name)
char *name;
{
- ld_emulation->syslib(name);
+ ld_emulation->syslib (name);
}
void
-ldemul_after_parse()
+ldemul_after_parse ()
{
- ld_emulation->after_parse();
+ ld_emulation->after_parse ();
}
void
-ldemul_before_parse()
+ldemul_before_parse ()
{
- ld_emulation->before_parse();
+ ld_emulation->before_parse ();
}
void
ld_emulation->after_open ();
}
-void
-ldemul_after_allocation()
+void
+ldemul_after_allocation ()
{
- ld_emulation->after_allocation();
+ ld_emulation->after_allocation ();
}
-void
-ldemul_before_allocation()
+void
+ldemul_before_allocation ()
{
if (ld_emulation->before_allocation)
- ld_emulation->before_allocation();
+ ld_emulation->before_allocation ();
}
-
void
-ldemul_set_output_arch()
+ldemul_set_output_arch ()
{
- ld_emulation->set_output_arch();
+ ld_emulation->set_output_arch ();
}
void
-ldemul_finish()
+ldemul_finish ()
{
if (ld_emulation->finish)
- ld_emulation->finish();
+ ld_emulation->finish ();
}
void
-ldemul_set_symbols()
+ldemul_set_symbols ()
{
if (ld_emulation->set_symbols)
- ld_emulation->set_symbols();
+ ld_emulation->set_symbols ();
}
void
-ldemul_create_output_section_statements()
+ldemul_create_output_section_statements ()
{
if (ld_emulation->create_output_section_statements)
- ld_emulation->create_output_section_statements();
+ ld_emulation->create_output_section_statements ();
}
char *
-ldemul_get_script(isfile)
+ldemul_get_script (isfile)
int *isfile;
{
- return ld_emulation->get_script(isfile);
+ return ld_emulation->get_script (isfile);
}
boolean
int argc;
char **argv;
{
- /* Try and use the emulation parser if there is one. */
+ /* Try and use the emulation parser if there is one. */
if (ld_emulation->parse_args)
{
return ld_emulation->parse_args (argc, argv);
}
char *
-ldemul_choose_target()
+ldemul_choose_target ()
{
- return ld_emulation->choose_target();
+ return ld_emulation->choose_target ();
}
/* The default choose_target function. */
char *
-ldemul_default_target()
+ldemul_default_target ()
{
char *from_outside = getenv (TARGET_ENVIRON);
- if (from_outside != (char *)NULL)
+ if (from_outside != (char *) NULL)
return from_outside;
return ld_emulation->target_name;
}
-void
-after_parse_default()
+void
+after_parse_default ()
{
}
}
void
-after_allocation_default()
+after_allocation_default ()
{
}
void
-before_allocation_default()
+before_allocation_default ()
{
}
void
-set_output_arch_default()
+set_output_arch_default ()
{
- /* Set the output architecture and machine if possible */
- bfd_set_arch_mach(output_bfd,
- ldfile_output_architecture, ldfile_output_machine);
+ /* Set the output architecture and machine if possible. */
+ bfd_set_arch_mach (output_bfd,
+ ldfile_output_architecture, ldfile_output_machine);
}
-/*ARGSUSED*/
void
-syslib_default(ignore)
- char *ignore ATTRIBUTE_UNUSED;
+syslib_default (ignore)
+ char *ignore ATTRIBUTE_UNUSED;
{
info_msg (_("%S SYSLIB ignored\n"));
}
-/*ARGSUSED*/
void
-hll_default(ignore)
- char *ignore ATTRIBUTE_UNUSED;
+hll_default (ignore)
+ char *ignore ATTRIBUTE_UNUSED;
{
info_msg (_("%S HLL ignored\n"));
}
ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
void
-ldemul_choose_mode(target)
+ldemul_choose_mode (target)
char *target;
{
- ld_emulation_xfer_type **eptr = ld_emulations;
- /* Ignore "gld" prefix. */
- if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd')
- target += 3;
- for (; *eptr; eptr++)
- {
- if (strcmp(target, (*eptr)->emulation_name) == 0)
- {
- ld_emulation = *eptr;
- return;
- }
- }
- einfo (_("%P: unrecognised emulation mode: %s\n"), target);
- einfo (_("Supported emulations: "));
- ldemul_list_emulations (stderr);
- einfo ("%F\n");
+ ld_emulation_xfer_type **eptr = ld_emulations;
+ /* Ignore "gld" prefix. */
+ if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd')
+ target += 3;
+ for (; *eptr; eptr++)
+ {
+ if (strcmp (target, (*eptr)->emulation_name) == 0)
+ {
+ ld_emulation = *eptr;
+ return;
+ }
+ }
+ einfo (_("%P: unrecognised emulation mode: %s\n"), target);
+ einfo (_("Supported emulations: "));
+ ldemul_list_emulations (stderr);
+ einfo ("%F\n");
}
void
void
ldemul_list_emulation_options (f)
- FILE * f;
+ FILE *f;
{
- ld_emulation_xfer_type ** eptr;
+ ld_emulation_xfer_type **eptr;
int options_found = 0;
-
- for (eptr = ld_emulations; * eptr; eptr ++)
+
+ for (eptr = ld_emulations; *eptr; eptr++)
{
- ld_emulation_xfer_type * emul = * eptr;
-
+ ld_emulation_xfer_type *emul = *eptr;
+
if (emul->list_options)
{
fprintf (f, "%s: \n", emul->emulation_name);
-
+
emul->list_options (f);
options_found = 1;
}
}
-
+
if (! options_found)
fprintf (f, _(" no emulation specific options.\n"));
}
int
ldemul_find_potential_libraries (name, entry)
- char * name;
- lang_input_statement_type * entry;
+ char *name;
+ lang_input_statement_type *entry;
{
if (ld_emulation->find_potential_libraries)
return ld_emulation->find_potential_libraries (name, entry);
*/
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
fprintf(config.map_file, "%c",code);
}
-static void
+static void
make_abs (ptr)
etree_value_type *ptr;
{
return new;
}
-static void
+static void
check (os, name, op)
lang_output_section_statement_type *os;
const char *name;
return new;
}
-static etree_value_type
+static etree_value_type
fold_binary (tree, current_section, allocation_done, dot, dotp)
etree_type *tree;
lang_output_section_statement_type *current_section;
make_abs(&other);
}
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case '%':
if (other.value == 0)
return result;
}
-etree_value_type
+etree_value_type
invalid ()
{
etree_value_type new;
return new;
}
-static etree_value_type
+static etree_value_type
fold_name (tree, current_section, allocation_done, dot)
etree_type *tree;
lang_output_section_statement_type *current_section;
bfd_vma dot;
{
etree_value_type result;
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case SIZEOF_HEADERS:
- if (allocation_done != lang_first_phase_enum)
+ if (allocation_done != lang_first_phase_enum)
{
result = new_abs ((bfd_vma)
bfd_sizeof_headers (output_bfd,
return result;
}
-etree_value_type
+etree_value_type
exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
etree_type *tree;
lang_output_section_statement_type *current_section;
return result;
}
- switch (tree->type.node_class)
+ switch (tree->type.node_class)
{
case etree_value:
result = new_rel (tree->value.value, current_section);
allocation_done, dot, dotp);
if (result.valid_p)
{
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case ALIGN_K:
if (allocation_done != lang_first_phase_enum)
result.value += result.section->bfd_section->vma;
result.section = abs_output_section;
}
- else
+ else
result.valid_p = false;
break;
dot, nextdot);
}
else
- *dotp = nextdot;
+ *dotp = nextdot;
}
}
}
return result;
}
-static etree_value_type
+static etree_value_type
exp_fold_tree_no_dot (tree, current_section, allocation_done)
etree_type *tree;
lang_output_section_statement_type *current_section;
return new;
}
-
etree_type *
exp_unop (code, child)
int code;
return new;
}
-
etree_type *
exp_nameop (code, name)
int code;
value.name.name = name;
value.name.type.node_class = etree_name;
-
r = exp_fold_tree_no_dot(&value,
(lang_output_section_statement_type *)NULL,
lang_first_phase_enum);
}
-
-
-
etree_type *
exp_assop (code, dst, src)
int code;
value.assign.type.node_code = code;
-
value.assign.src = src;
value.assign.dst = dst;
value.assign.type.node_class = etree_assign;
return n;
}
-void
+void
exp_print_tree (tree)
etree_type *tree;
{
break;
case etree_unary:
exp_print_token(tree->unary.type.node_code);
- if (tree->unary.child)
+ if (tree->unary.child)
{
fprintf(config.map_file,"(");
exp_print_tree(tree->unary.child);
fprintf(config.map_file,")");
}
-
+
break;
case etree_assert:
return def;
}
-int
+int
exp_get_value_int (tree,def,name, allocation_done)
etree_type *tree;
int def;
return (int)exp_get_vma(tree,(bfd_vma)def,name, allocation_done);
}
-
bfd_vma
exp_get_abs_int (tree, def, name, allocation_done)
etree_type *tree;
static search_dirs_type **search_tail_ptr = &search_head;
-typedef struct search_arch
+typedef struct search_arch
{
- char *name;
+ char *name;
struct search_arch *next;
} search_arch_type;
static search_arch_type *search_arch_head;
static search_arch_type **search_arch_tail_ptr = &search_arch_head;
-
+
static FILE *try_open PARAMS ((const char *name, const char *exten));
void
for (search = search_head;
search != (search_dirs_type *)NULL;
- search = search->next)
+ search = search->next)
{
char *string;
lib, entry->filename, arch, suffix);
else if (entry->filename[0] == '/' || entry->filename[0] == '.'
#if defined (__MSDOS__) || defined (_WIN32)
- || entry->filename[0] == '\\'
- || (isalpha (entry->filename[0])
+ || entry->filename[0] == '\\'
+ || (isalpha (entry->filename[0])
&& entry->filename[1] == ':')
#endif
)
if (ldemul_find_potential_libraries (arch->name, entry))
return;
}
-
+
einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name);
}
}
char buff[1000];
result = fopen (name, "r");
-
+
if (trace_file_tries)
{
if (result == NULL)
{
sprintf (buff, "%s%s", name, exten);
result = fopen (buff, "r");
-
+
if (trace_file_tries)
{
if (result == NULL)
search = search->next)
{
sprintf (buffer,"%s%s%s", search->name, slash, name);
-
+
result = try_open (buffer, extend);
if (result)
break;
}
}
-
+
return result;
}
bfd_set_error (bfd_error_system_call);
einfo (_("%P%F: cannot open linker script file %s: %E\n"), name);
}
-
+
lex_push_file (ldlex_input_stack, name);
-
+
ldfile_input_filename = name;
lineno = 1;
had_script = true;
NULL, ""
};
struct tabentry *tp;
-
for (tp = arch_tab; tp->cmd_switch != NULL; tp++)
{
if (tp->cmd_switch == NULL)
einfo (_("%P%F: unknown architecture: %s\n"),name);
-
+
return tp->arch;
}
search_arch_type *new =
(search_arch_type *)xmalloc ((bfd_size_type)(sizeof (search_arch_type)));
-
if (*name != '\0')
{
if (ldfile_output_machine_name[0] != '\0')
einfo (_("%P%F: target architecture respecified\n"));
return;
}
-
+
ldfile_output_machine_name = name;
}
#else /* not GNU960 */
-
void
ldfile_add_arch (in_name)
CONST char * in_name;
size_t,
lang_statement_list_type*));
-
/* LOCALS */
static struct obstack stat_obstack;
etree_type *base; /* Relocation base - or null */
-
#if defined(__STDC__) || defined(ALMOST_STDC)
#define cat(a,b) a##b
#else
callback_t callback;
PTR data;
{
- /* Don't process sections from files which were excluded. */
+ /* Don't process sections from files which were excluded. */
if (ptr->exclude_filename_list != NULL)
{
struct name_list *list_tmp;
}
}
-
static lang_memory_region_type *
lang_memory_default (section)
asection *section;
static struct bfd_hash_table already_linked_table;
-/*ARGSUSED*/
static void
section_already_linked (abfd, sec, data)
bfd *abfd;
if (section->flags & SEC_BLOCK)
{
section->output_section->flags |= SEC_BLOCK;
- /* FIXME: This value should really be obtained from the bfd... */
+ /* FIXME: This value should really be obtained from the bfd... */
output->block_value = 128;
}
}
entry->loaded = true;
}
-
-
/* Handle a wild statement. SECTION or FILE or both may be NULL,
indicating that it is a wildcard. Separate lang_input_section
statements are created for each part of the expansion; they are
}
/* Oh dear, we now have two potential candidates for a successful match.
- Compare their names and choose the better one. */
+ Compare their names and choose the better one. */
if (name_compare (target->name, original->name) > name_compare (winner->name, original->name))
winner = target;
default_common_section =
lang_output_section_statement_lookup (".bss");
-
if (placed_commons == false)
{
lang_wild_statement_type *new =
switch (s->header.type)
{
-
case lang_wild_statement_enum:
wild (&s->wild_statement, s->wild_statement.section_name,
s->wild_statement.filename, target,
new->padding_statement.size = alignment_needed * opb;
}
-
/* Remember the most restrictive alignment */
if (power > output_section_statement->alignment_power)
{
if (os->load_base)
{
/* If nothing has been placed into the output section then
- it won't have a bfd_section. */
+ it won't have a bfd_section. */
if (os->bfd_section)
{
os->bfd_section->lma
}
}
-
void
lang_set_flags (ptr, flags, invert)
lang_memory_region_type *ptr;
}
}
-
static lang_output_section_statement_type *current_section;
static int
os =
lang_output_section_statement_lookup (output_section_statement_name);
-
-
/* Add this statement to tree */
/* add_statement(lang_output_section_statement_enum,
output_section_statement);*/
map_input_to_output_sections (statement_list.head, (char *) NULL,
(lang_output_section_statement_type *) NULL);
-
/* Find any sections not attached explicitly and handle them */
lang_place_orphans ();