* deffile.h: Fix formatting.
* ld.h: Likewise.
* ldctor.h: Likewise.
* ldemul.h: Likewise.
* ldexp.h: Likewise.
* ldfile.h: Likewise.
* ldlang.h: Likewise.
* lexsup.c: Likewise.
* mri.c: Likewise.
* pe-dll.c: Likewise.
2000-09-29 Kazu Hirata <kazu@hxi.com>
- * ldcref.c: Fix formatting.
+ * deffile.h: Fix formatting.
+ * ld.h: Likewise.
+ * ldcref.c: Likewise.
* ldctor.c: Likewise.
+ * ldctor.h: Likewise.
* ldemul.c: Likewise.
+ * ldemul.h: Likewise.
* ldexp.c: Likewise.
+ * ldexp.h: Likewise.
* ldfile.c: Likewise.
+ * ldfile.h: Likewise.
* ldlang.c: Likewise.
+ * ldlang.h: Likewise.
+ * lexsup.c: Likewise.
+ * mri.c: Likewise.
+ * pe-dll.c: Likewise.
2000-09-28 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
/* deffile.h - header for .DEF file parser
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Written by DJ Delorie dj@cygnus.com
This file is part of GLD, the Gnu Linker.
#include "ansidecl.h"
/* DEF storage definitions. Note that any ordinal may be zero, and
- any pointer may be NULL, if not defined by the DEF file. */
+ any pointer may be NULL, if not defined by the DEF file. */
typedef struct def_file_section
{
struct lang_input_statement_struct *file;
} section_userdata_type;
-
#define get_userdata(x) ((x)->userdata)
#define BYTE_SIZE (1)
file. */
boolean embedded_relocs;
- /* If true, force generation of a file with a .exe file. */
+ /* If true, force generation of a file with a .exe file. */
boolean force_exe_suffix;
/* If true, generate a cross reference report. */
/* If true (the default) check section addresses, once compute,
fpor overlaps. */
boolean check_section_addresses;
-
+
} args_type;
extern args_type command_line;
typedef int token_code_type;
-typedef struct
+typedef struct
{
bfd_size_type specified_data_size;
boolean magic_demand_paged;
/* ldctor.h - linker constructor support
- Copyright 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
-
+ Copyright 1991, 92, 93, 94, 95, 98, 2000 Free Software Foundation, Inc.
+
This file is part of GLD, the Gnu Linker.
GLD is free software; you can redistribute it and/or modify
/* ld-emul.h - Linker emulation header file
- Copyright 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 96, 97, 1998, 2000
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
boolean (*place_orphan)
PARAMS ((struct lang_input_statement_struct *, asection *));
- /* Run after assigning parsing with the args, but before
- reading the script. Used to initialize symbols used in the script. */
+ /* Run after assigning parsing with the args, but before
+ reading the script. Used to initialize symbols used in the script. */
void (*set_symbols) PARAMS ((void));
/* Run to parse args which the base linker doesn't
- understand. Return non zero on sucess. */
+ understand. Return non zero on sucess. */
int (*parse_args) PARAMS ((int, char **));
/* Run to handle files which are not recognized as object files or
(For VMS files matching ":lib*.a" have also been scanned). */
int (* find_potential_libraries)
PARAMS ((char *, struct lang_input_statement_struct *));
-
+
} ld_emulation_xfer_type;
-typedef enum
+typedef enum
{
intel_ic960_ld_mode_enum,
default_mode_enum ,
/* ldexp.h -
- Copyright 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 98, 2000
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#define LDEXP_H
/* The result of an expression tree */
-typedef struct
+typedef struct
{
bfd_vma value;
struct lang_output_section_statement_struct *section;
boolean valid_p;
} etree_value_type;
-
-
-typedef struct
+typedef struct
{
int node_code;
enum { etree_binary,
etree_rel } node_class;
} node_type;
-
-
-typedef union etree_union
+typedef union etree_union
{
node_type type;
struct {
} assert_s;
} etree_type;
-
etree_type *exp_intop PARAMS ((bfd_vma));
etree_type *exp_relop PARAMS ((asection *, bfd_vma));
etree_value_type invalid PARAMS ((void));
/* Structure used to hold the list of directories to search for
libraries. */
-typedef struct search_dirs
+typedef struct search_dirs
{
/* Next directory on list. */
struct search_dirs *next;
/* ldlang.h - linker command language support
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
-
+
This file is part of GLD, the Gnu Linker.
-
+
GLD is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
-
+
GLD is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
union lang_statement_union **tail;
} lang_statement_list_type;
-
typedef struct memory_region_struct
{
char *name;
boolean had_full_message;
} lang_memory_region_type ;
-typedef struct lang_statement_header_struct
+typedef struct lang_statement_header_struct
{
union lang_statement_union *next;
enum statement_enum
} type;
} lang_statement_header_type;
-
-typedef struct
+typedef struct
{
lang_statement_header_type header;
union etree_union *exp;
} lang_assignment_statement_type;
-
typedef struct lang_target_statement_struct
{
lang_statement_header_type header;
const char *target;
} lang_target_statement_type;
-
typedef struct lang_output_statement_struct
{
lang_statement_header_type header;
boolean used;
};
-typedef struct lang_output_section_statement_struct
+typedef struct lang_output_section_statement_struct
{
lang_statement_header_type header;
union etree_union *addr_tree;
const char *name;
boolean processed;
-
+
asection *bfd_section;
flagword flags; /* Or together of all input sections */
enum section_type sectype;
struct lang_output_section_phdr_list *phdrs;
} lang_output_section_statement_type;
-
typedef struct
{
lang_statement_header_type header;
/* Usually the same as filename, but for a file spec'd with -l
this is the -l switch itself rather than the filename. */
const char *local_sym_name;
-
+
bfd *the_bfd;
-
+
boolean closed;
file_ptr passive_position;
-
+
/* Symbol table of the file. */
asymbol **asymbols;
unsigned int symbol_count;
-
+
/* Point to the next file - whatever it is, wanders up and down
archives */
-
+
union lang_statement_union *next;
/* Point to the next file, but skips archive contents */
union lang_statement_union *next_real_file;
-
+
boolean is_archive;
-
+
/* 1 means search a set of directories for this file. */
boolean search_dirs_flag;
-
+
/* 1 means this is base file of incremental load.
Do not load this file's text or data.
- Also default text_start to after this file's bss. */
-
+ Also default text_start to after this file's bss. */
+
boolean just_syms_flag;
/* Whether to search for this entry as a dynamic archive. */
boolean whole_archive;
boolean loaded;
-
+
/* unsigned int globals_in_this_file;*/
const char *target;
boolean real;
lang_statement_header_type header;
asection *section;
lang_input_statement_type *ifile;
-
-} lang_input_section_type;
+} lang_input_section_type;
typedef struct
{
lang_statement_list_type children;
} lang_group_statement_type;
-typedef union lang_statement_union
+typedef union lang_statement_union
{
lang_statement_header_type header;
union lang_statement_union *next;
for (statement = (lang_input_statement_type *)file_chain.head;\
statement != (lang_input_statement_type *)NULL; \
statement = (lang_input_statement_type *)statement->next)\
-
+
extern void lang_process PARAMS ((void));
extern void ldlang_add_file PARAMS ((lang_input_statement_type *));
extern lang_output_section_statement_type *lang_output_section_find
#endif
#endif
-/* Somewhere above, sys/stat.h got included . . . . */
+/* Somewhere above, sys/stat.h got included . . . . */
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
if (optarg != NULL)
{
enum demangling_styles style;
-
+
style = cplus_demangle_name_to_style (optarg);
- if (style == unknown_demangling)
+ if (style == unknown_demangling)
einfo (_("%F%P: unknown demangling style `%s'"),
optarg);
-
+
cplus_demangle_set_style (style);
}
break;
link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
break;
case 'o':
- lang_add_output (optarg, 0);
+ lang_add_output (optarg, 0);
break;
case OPTION_OFORMAT:
lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
}
optarg2 ++;
-
+
/* So far so good. Are all the args present? */
if ((*optarg == '\0') || (*optarg2 == '\0'))
{
the GNU General Public License. This program has absolutely no warranty.\n"));
{
ld_emulation_xfer_type **ptr = ld_emulations;
-
+
printf (_(" Supported emulations:\n"));
- while (*ptr)
+ while (*ptr)
{
printf (" %s\n", (*ptr)->emulation_name);
ptr++;
config.split_by_reloc = strtoul (optarg, NULL, 0);
else
config.split_by_reloc = 32768;
- break;
+ break;
case OPTION_SPLIT_BY_FILE:
if (optarg != NULL)
config.split_by_file = bfd_scan_vma (optarg, NULL, 0);
else
config.split_by_file = 1;
- break;
+ break;
case OPTION_CHECK_SECTIONS:
command_line.check_section_addresses = true;
break;
case OPTION_INIT:
link_info.init_function = optarg;
break;
-
+
case OPTION_FINI:
link_info.fini_function = optarg;
break;
Contributed by Steve Chamberlain <sac@cygnus.com>. */
#include "bfd.h"
-#include "sysdep.h"
+#include "sysdep.h"
#include "ld.h"
#include "ldexp.h"
#include "ldlang.h"
struct section_name_struct **list;
{
struct section_name_struct **ptr = list;
-
- while (*ptr)
+
+ while (*ptr)
{
if (strcmp (name, (*ptr)->name) == 0)
/* If this is a match, delete it, we only keep the last instance
etree_type *subalign;
{
struct section_name_struct **ptr = lookup (name,list);
-
+
(*ptr)->name = name;
(*ptr)->vma = vma;
(*ptr)->next = (struct section_name_struct *) NULL;
/* Create the regions. */
{
lang_memory_region_type *r;
-
+
r = lang_memory_region_lookup("long");
r->current = r->origin = exp_get_vma (base, (bfd_vma)0, "origin",
lang_first_phase_enum);
"length", lang_first_phase_enum);
}
#endif
-
+
/* Now build the statements for the ldlang machine. */
/* Attatch the addresses of any which have addresses,
{
struct section_name_struct *alist;
struct section_name_struct *olist;
-
+
if (order == (struct section_name_struct *)NULL)
order = address;
for (alist = address;
alist != (struct section_name_struct*)NULL;
- alist = alist->next)
+ alist = alist->next)
{
int done = 0;
-
+
for (olist = order;
done == 0 &&
olist != (struct section_name_struct *)NULL;
- olist = olist->next)
+ olist = olist->next)
{
- if (strcmp (alist->name, olist->name) == 0)
+ if (strcmp (alist->name, olist->name) == 0)
{
olist->vma = alist->vma;
done = 1;
}
}
-
+
if (!done)
{
/* Add this onto end of order list. */
/* If we're only supposed to load a subset of them in, then prune
the list. */
- if (only_load != (struct section_name_struct *)NULL)
+ if (only_load != (struct section_name_struct *)NULL)
{
struct section_name_struct *ptr1;
struct section_name_struct *ptr2;
-
+
if (order == (struct section_name_struct*)NULL)
order = only_load;
-
+
/* See if this name is in the list, if it is then we can load it. */
- for (ptr1 = only_load; ptr1; ptr1 = ptr1->next)
- for (ptr2 = order; ptr2; ptr2 = ptr2->next)
+ for (ptr1 = only_load; ptr1; ptr1 = ptr1->next)
+ for (ptr2 = order; ptr2; ptr2 = ptr2->next)
if (strcmp (ptr2->name, ptr1->name) == 0)
ptr2->ok_to_load = 1;
}
- else
+ else
{
/* No only load list, so everything is ok to load. */
struct section_name_struct *ptr;
-
+
for (ptr = order; ptr; ptr=ptr->next)
ptr->ok_to_load = 1;
}
/* Create the order of sections to load. */
- if (order != (struct section_name_struct *)NULL)
+ if (order != (struct section_name_struct *)NULL)
{
/* Been told to output the sections in a certain order. */
struct section_name_struct *p = order;
-
- while (p)
+
+ while (p)
{
struct section_name_struct *aptr;
etree_type *align = 0;
etree_type *subalign = 0;
-
+
/* See if an alignment has been specified. */
for (aptr = alignment; aptr; aptr= aptr->next)
if (strcmp (aptr->name, p->name) == 0)
(etree_type *) NULL);
base = 0;
lang_add_wild (p->name, false, (char *)NULL, false, false, NULL);
-
+
/* If there is an alias for this section, add it too. */
for (aptr = alias; aptr; aptr = aptr->next)
if (strcmp (aptr->alias, p->name) == 0)
lang_add_wild (aptr->name, false, (char *)NULL, false, false, NULL);
lang_leave_output_section_statement
- (0, "*default*", (struct lang_output_section_phdr_list *) NULL,
+ (0, "*default*", (struct lang_output_section_phdr_list *) NULL,
"*default*");
p = p->next;
base = 0;
lang_add_input_file (name,
lang_input_file_is_file_enum, (char *)NULL);
-#if 0
+#if 0
lang_leave_output_section_statement (0,"*default*");
#endif
}
mri_add_to_list (& order, name, 0, 0,0,0);
}
-void
+void
mri_alias (want, is, isn)
CONST char *want;
CONST char *is;
if (!is)
{
char buf[20];
-
+
/* Some sections are digits. */
sprintf (buf, "%d", isn);
-
+
is = xstrdup (buf);
-
+
if (is == NULL)
abort ();
}
-
+
mri_add_to_list (& alias, is, 0, want,0,0);
}
-void
+void
mri_name (name)
CONST char *name;
{
{
if (strcmp (name, "S") == 0)
lang_add_output_format ("srec", (char *) NULL, (char *) NULL, 1);
-
+
else if (strcmp (name, "IEEE") == 0)
lang_add_output_format ("ieee", (char *) NULL, (char *) NULL, 1);
-
+
else if (strcmp (name, "COFF") == 0)
lang_add_output_format ("coff-m68k", (char *) NULL, (char *) NULL, 1);
-
+
else
einfo (_("%P%F: unknown format type %s\n"), name);
}
lang_add_assignment (exp_assop ('=', name, exp));
}
-void
+void
mri_align (name, exp)
CONST char *name;
etree_type *exp;
mri_add_to_list (& alignment, name, 0, 0, exp, 0);
}
-void
+void
mri_alignmod (name, exp)
CONST char *name;
etree_type *exp;
mri_add_to_list (& subalignment, name, 0, 0, 0, exp);
}
-void
+void
mri_truncate (exp)
unsigned int exp;
{
symbol_truncate = exp;
}
-
/* These correspond to the entries in pe_def_file->exports[]. I use
exported_symbol_sections[i] to tag whether or not the symbol was
- defined, since we can't export symbols we don't have. */
+ defined, since we can't export symbols we don't have. */
static bfd_vma *exported_symbol_offsets;
static struct sec **exported_symbol_sections;
exported_symbol_sections[i] = blhe->u.def.section;
else
exported_symbol_sections[i] = blhe->u.c.p->section;
-
+
if (pe_def_file->exports[i].ordinal != -1)
{
if (max_ordinal < pe_def_file->exports[i].ordinal)
const char *dlnp;
/* First, we need to know how many exported symbols there are,
- and what the range of ordinals is. */
+ and what the range of ordinals is. */
if (pe_def_file->name)
{
{
int i;
struct bfd_link_hash_entry *blhe;
-
+
for (i = 0; i < pe_def_file->num_exports; i++)
{
char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+ sym->section->output_offset
+ sym->section->output_section->vma);
reloc_data[total_relocs].vma = sec_vma + relocs[i]->address;
-
+
#define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift)
-
+
switch BITS_AND_SHIFT (relocs[i]->howto->bitsize,
relocs[i]->howto->rightshift)
{
/* At this point, we have total_relocs relocation addresses in
reloc_addresses, which are all suitable for the .reloc section.
- We must now create the new sections. */
+ We must now create the new sections. */
qsort (reloc_data, total_relocs, sizeof (*reloc_data), reloc_sort);
for (i = 0; i < total_relocs; i++)
{
unsigned long this_page = (reloc_data[i].vma >> 12);
-
+
if (this_page != sec_page)
{
reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align */
reloc_sz += 8;
sec_page = this_page;
}
-
+
reloc_sz += 2;
-
+
if (reloc_data[i].type == 4)
reloc_sz += 2;
}
it. We create a four-byte section to mark the beginning of the
list, and we include an offset of 4 in the section, so that the
pointer to the list points to the *end* of this section, which is
- the start of the list of sections from other objects. */
+ the start of the list of sections from other objects. */
bfd_set_section_size (abfd, id2, 20);
d2 = (unsigned char *) xmalloc (20);
bfd_set_section_contents (abfd, id2, d2, 0, 20);
bfd_set_section_contents (abfd, id5, d5, 0, 4);
bfd_set_section_contents (abfd, id4, d4, 0, 4);
-
+
bfd_make_readable (abfd);
return abfd;
}
quick_symbol (abfd, U("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
quick_symbol (abfd, U("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
if (pe_dll_compat_implib)
- quick_symbol (abfd, U("__imp_"), exp->internal_name, "",
+ quick_symbol (abfd, U("__imp_"), exp->internal_name, "",
id5, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, tx, jmp_byte_count);
/* xgettext:c-format */
einfo (_("Creating library file: %s\n"), impfilename);
-
+
bfd_set_format (outarch, bfd_archive);
outarch->has_armap = 1;
- /* Work out a reasonable size of things to put onto one line. */
+ /* Work out a reasonable size of things to put onto one line. */
ar_head = make_head (outarch);
if (! bfd_set_archive_head (outarch, head))
einfo ("%Xbfd_set_archive_head: %s\n", bfd_errmsg (bfd_get_error ()));
-
+
if (! bfd_close (outarch))
einfo ("%Xbfd_close %s: %s\n", impfilename, bfd_errmsg (bfd_get_error ()));
const char *dll_name;
/* No, I can't use bfd here. kernel32.dll puts its export table in
- the middle of the .rdata section. */
+ the middle of the .rdata section. */
dll = bfd_openr (filename, pe_details->target_name);
if (!dll)