2000-09-29 Kazu Hirata <kazu@hxi.com>

* 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.
This commit is contained in:
Kazu Hirata 2000-09-29 13:21:41 +00:00
parent 512a2384fe
commit 5cc18311d9
11 changed files with 119 additions and 120 deletions

View File

@ -1,11 +1,21 @@
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>

View File

@ -1,5 +1,5 @@
/* 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.
@ -25,7 +25,7 @@
#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
{

View File

@ -81,7 +81,6 @@ typedef struct user_section_struct
struct lang_input_statement_struct *file;
} section_userdata_type;
#define get_userdata(x) ((x)->userdata)
#define BYTE_SIZE (1)
@ -127,7 +126,7 @@ typedef struct
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. */
@ -155,14 +154,14 @@ typedef struct
/* 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;

View File

@ -1,6 +1,6 @@
/* 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

View File

@ -1,5 +1,6 @@
/* 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.
@ -111,12 +112,12 @@ typedef struct ld_emulation_xfer_struct
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
@ -138,10 +139,10 @@ typedef struct ld_emulation_xfer_struct
(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 ,

View File

@ -1,5 +1,6 @@
/* 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.
@ -22,16 +23,14 @@
#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,
@ -47,9 +46,7 @@ typedef struct
etree_rel } node_class;
} node_type;
typedef union etree_union
typedef union etree_union
{
node_type type;
struct {
@ -93,7 +90,6 @@ typedef union etree_union
} 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));

View File

@ -29,7 +29,7 @@ extern const char *ldfile_output_machine_name;
/* 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;

View File

@ -1,19 +1,19 @@
/* 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
@ -39,7 +39,6 @@ typedef struct statement_list
union lang_statement_union **tail;
} lang_statement_list_type;
typedef struct memory_region_struct
{
char *name;
@ -53,7 +52,7 @@ typedef struct memory_region_struct
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
@ -78,21 +77,18 @@ typedef struct lang_statement_header_struct
} 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;
@ -121,7 +117,7 @@ struct lang_output_section_phdr_list
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;
@ -131,7 +127,7 @@ typedef struct lang_output_section_statement_struct
const char *name;
boolean processed;
asection *bfd_section;
flagword flags; /* Or together of all input sections */
enum section_type sectype;
@ -148,7 +144,6 @@ typedef struct lang_output_section_statement_struct
struct lang_output_section_phdr_list *phdrs;
} lang_output_section_statement_type;
typedef struct
{
lang_statement_header_type header;
@ -219,32 +214,32 @@ typedef struct lang_input_statement_struct
/* 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. */
@ -254,7 +249,7 @@ typedef struct lang_input_statement_struct
boolean whole_archive;
boolean loaded;
/* unsigned int globals_in_this_file;*/
const char *target;
boolean real;
@ -265,9 +260,8 @@ typedef struct
lang_statement_header_type header;
asection *section;
lang_input_statement_type *ifile;
} lang_input_section_type;
} lang_input_section_type;
typedef struct
{
@ -315,7 +309,7 @@ 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;
@ -435,7 +429,7 @@ extern bfd_vma lang_do_assignments
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

View File

@ -47,7 +47,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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
@ -597,12 +597,12 @@ parse_args (argc, argv)
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;
@ -729,7 +729,7 @@ parse_args (argc, argv)
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);
@ -874,7 +874,7 @@ parse_args (argc, argv)
}
optarg2 ++;
/* So far so good. Are all the args present? */
if ((*optarg == '\0') || (*optarg2 == '\0'))
{
@ -945,9 +945,9 @@ This program is free software; you may redistribute it under the terms of\n\
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++;
@ -1015,13 +1015,13 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
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;
@ -1072,7 +1072,7 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
case OPTION_INIT:
link_info.init_function = optarg;
break;
case OPTION_FINI:
link_info.fini_function = optarg;
break;

View File

@ -25,7 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
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"
@ -67,8 +67,8 @@ lookup (name, list)
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
@ -92,7 +92,7 @@ mri_add_to_list (list, name, vma, zalias, align, subalign)
etree_type *subalign;
{
struct section_name_struct **ptr = lookup (name,list);
(*ptr)->name = name;
(*ptr)->vma = vma;
(*ptr)->next = (struct section_name_struct *) NULL;
@ -139,7 +139,7 @@ mri_draw_tree ()
/* 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);
@ -147,7 +147,7 @@ mri_draw_tree ()
"length", lang_first_phase_enum);
}
#endif
/* Now build the statements for the ldlang machine. */
/* Attatch the addresses of any which have addresses,
@ -156,28 +156,28 @@ mri_draw_tree ()
{
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. */
@ -188,41 +188,41 @@ mri_draw_tree ()
/* 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)
@ -241,14 +241,14 @@ mri_draw_tree ()
(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;
@ -265,7 +265,7 @@ mri_load (name)
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
}
@ -277,7 +277,7 @@ mri_order (name)
mri_add_to_list (& order, name, 0, 0,0,0);
}
void
void
mri_alias (want, is, isn)
CONST char *want;
CONST char *is;
@ -286,20 +286,20 @@ mri_alias (want, is, isn)
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;
{
@ -312,13 +312,13 @@ mri_format (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);
}
@ -331,7 +331,7 @@ mri_public (name, exp)
lang_add_assignment (exp_assop ('=', name, exp));
}
void
void
mri_align (name, exp)
CONST char *name;
etree_type *exp;
@ -339,7 +339,7 @@ mri_align (name, exp)
mri_add_to_list (& alignment, name, 0, 0, exp, 0);
}
void
void
mri_alignmod (name, exp)
CONST char *name;
etree_type *exp;
@ -347,10 +347,9 @@ mri_alignmod (name, exp)
mri_add_to_list (& subalignment, name, 0, 0, 0, exp);
}
void
void
mri_truncate (exp)
unsigned int exp;
{
symbol_truncate = exp;
}

View File

@ -186,7 +186,7 @@ pe_export_sort (va, vb)
/* 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;
@ -434,7 +434,7 @@ process_def_file (abfd, info)
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)
@ -541,7 +541,7 @@ generate_edata (abfd, info)
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)
{
@ -626,7 +626,7 @@ fill_exported_offsets (abfd, info)
{
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);
@ -806,9 +806,9 @@ generate_reloc (abfd, info)
+ 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)
{
@ -849,23 +849,23 @@ generate_reloc (abfd, info)
/* 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;
}
@ -1247,7 +1247,7 @@ make_head (parent)
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);
@ -1274,7 +1274,7 @@ make_head (parent)
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;
}
@ -1451,7 +1451,7 @@ make_one (exp, parent)
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);
@ -1575,11 +1575,11 @@ pe_dll_generate_implib (def, impfilename)
/* 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);
@ -1608,7 +1608,7 @@ pe_dll_generate_implib (def, impfilename)
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 ()));
@ -1772,7 +1772,7 @@ pe_implied_import_dll (filename)
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)