* deffilep.y (def_stash_module): Constify "name" param.

* pe-dll.c: Replace CONST with const throughout.
	(quick_symbol): Constify "n1", "n2", "n3" params.
	(make_singleton_name_thunk): Constify "import" param.  Make
	"buffer_len" a size_t.
	(make_import_fixup_entry): Constify "name", "fixup_name",
	"dll_symname" params.
	(pe_get16): Cast args of bfd_seek.  Replace bfd_read with bfd_bread.
	(pe_get32): Likewise.
	(pe_implied_import_dll): Likewise.

	* emultempl/beos.em (sort_by_file_name): Constify "ra", "rb".
	(sort_by_section_name): Likewise.

	* emultempl/pe.em: Move defines for arm_epoc_pe before bfd.h included.
	(make_import_fixup): Cast printf arg, rel->address to long rather
	than int.
	(gld_${EMULATION_NAME}_after_open): Don't compare NULL against int.
This commit is contained in:
Alan Modra 2001-09-18 10:10:21 +00:00
parent 0e1a166b28
commit db09f25b32
5 changed files with 70 additions and 44 deletions

View File

@ -1,3 +1,25 @@
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* deffilep.y (def_stash_module): Constify "name" param.
* pe-dll.c: Replace CONST with const throughout.
(quick_symbol): Constify "n1", "n2", "n3" params.
(make_singleton_name_thunk): Constify "import" param. Make
"buffer_len" a size_t.
(make_import_fixup_entry): Constify "name", "fixup_name",
"dll_symname" params.
(pe_get16): Cast args of bfd_seek. Replace bfd_read with bfd_bread.
(pe_get32): Likewise.
(pe_implied_import_dll): Likewise.
* emultempl/beos.em (sort_by_file_name): Constify "ra", "rb".
(sort_by_section_name): Likewise.
* emultempl/pe.em: Move defines for arm_epoc_pe before bfd.h included.
(make_import_fixup): Cast printf arg, rel->address to long rather
than int.
(gld_${EMULATION_NAME}_after_open): Don't compare NULL against int.
2001-09-15 Alan Modra <amodra@bigpond.net.au>
* ldmain.c (main): Rename BufferSize to ld_bufsz because HPUX

View File

@ -1,6 +1,7 @@
%{ /* deffilep.y - parser for .def files */
/* Copyright 1995, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
/* Copyright 1995, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@ -83,7 +84,7 @@ static void def_heapsize PARAMS ((int, int));
static void def_import
PARAMS ((const char *, const char *, const char *, const char *, int));
static void def_library PARAMS ((const char *, int));
static def_file_module *def_stash_module PARAMS ((def_file *, char *));
static def_file_module *def_stash_module PARAMS ((def_file *, const char *));
static void def_name PARAMS ((const char *, int));
static void def_section PARAMS ((const char *, int));
static void def_section_alt PARAMS ((const char *, const char *));
@ -495,7 +496,7 @@ def_file_add_export (def, external_name, internal_name, ordinal)
static def_file_module *
def_stash_module (def, name)
def_file *def;
char *name;
const char *name;
{
def_file_module *s;
for (s=def->modules; s; s=s->next)
@ -532,7 +533,7 @@ def_file_add_import (def, name, module, ordinal, internal_name)
if (name)
i->name = xstrdup (name);
if (module)
i->module = def_stash_module(def, module);
i->module = def_stash_module (def, module);
i->ordinal = ordinal;
if (internal_name)
i->internal_name = xstrdup (internal_name);

View File

@ -461,8 +461,8 @@ sort_by_file_name (a, b)
const PTR a;
const PTR b;
{
lang_statement_union_type **ra = a;
lang_statement_union_type **rb = b;
const lang_statement_union_type *const *ra = a;
const lang_statement_union_type *const *rb = b;
int i, a_sec, b_sec;
i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename,
@ -518,8 +518,8 @@ sort_by_section_name (a, b)
const PTR a;
const PTR b;
{
lang_statement_union_type **ra = a;
lang_statement_union_type **rb = b;
const lang_statement_union_type *const *ra = a;
const lang_statement_union_type *const *rb = b;
int i;
i = strcmp ((*ra)->input_section.section->name,
(*rb)->input_section.section->name);

View File

@ -33,6 +33,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
only determine if the subsystem is console or windows in order to select
the correct entry point by default. */
#define TARGET_IS_${EMULATION_NAME}
/* Do this before including bfd.h, so we prototype the right functions. */
#ifdef TARGET_IS_arm_epoc_pe
#define bfd_arm_pe_allocate_interworking_sections \
bfd_arm_epoc_pe_allocate_interworking_sections
#define bfd_arm_pe_get_bfd_for_interworking \
bfd_arm_epoc_pe_get_bfd_for_interworking
#define bfd_arm_pe_process_before_allocation \
bfd_arm_epoc_pe_process_before_allocation
#endif
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
@ -59,8 +71,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#define TARGET_IS_${EMULATION_NAME}
/* Permit the emulation parameters to override the default section
alignment by setting OVERRIDE_SECTION_ALIGNMENT. FIXME: This makes
it seem that include/coff/internal.h should not define
@ -94,15 +104,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define PE_DEF_FILE_ALIGNMENT 0x00000200
#endif
#ifdef TARGET_IS_arm_epoc_pe
#define bfd_arm_pe_allocate_interworking_sections \
bfd_arm_epoc_pe_allocate_interworking_sections
#define bfd_arm_pe_get_bfd_for_interworking \
bfd_arm_epoc_pe_get_bfd_for_interworking
#define bfd_arm_pe_process_before_allocation \
bfd_arm_epoc_pe_process_before_allocation
#endif
static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void));
static void gld_${EMULATION_NAME}_after_open PARAMS ((void));
static void gld_${EMULATION_NAME}_before_parse PARAMS ((void));
@ -853,8 +854,8 @@ make_import_fixup (rel, s)
if (pe_dll_extra_pe_debug)
{
printf ("arelent: %s@%#x: add=%li\n", sym->name,
(int) rel->address, rel->addend);
printf ("arelent: %s@%#lx: add=%li\n", sym->name,
(long) rel->address, (long) rel->addend);
}
{
@ -979,7 +980,7 @@ gld_${EMULATION_NAME}_after_open ()
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == NULL)
if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
einfo (_("%F%P: PE operations on non PE file.\n"));
pe_data (output_bfd)->pe_opthdr = pe;

View File

@ -281,14 +281,16 @@ static void generate_reloc PARAMS ((bfd *, struct bfd_link_info *));
static void quoteput PARAMS ((char *, FILE *, int));
static asection *quick_section PARAMS ((bfd *, const char *, int, int));
static void quick_symbol
PARAMS ((bfd *, char *, char *, char *, asection *, int, int));
PARAMS ((bfd *, const char *, const char *, const char *,
asection *, int, int));
static void quick_reloc PARAMS ((bfd *, int, int, int));
static bfd *make_head PARAMS ((bfd *));
static bfd *make_tail PARAMS ((bfd *));
static bfd *make_one PARAMS ((def_file_export *, bfd *));
static bfd *make_singleton_name_thunk PARAMS ((char *, bfd *));
static bfd *make_singleton_name_thunk PARAMS ((const char *, bfd *));
static char *make_import_fixup_mark PARAMS ((arelent *));
static bfd *make_import_fixup_entry PARAMS ((char *, char *, char *, bfd *));
static bfd *make_import_fixup_entry
PARAMS ((const char *, const char *, const char *, bfd *));
static unsigned int pe_get16 PARAMS ((bfd *, int));
static unsigned int pe_get32 PARAMS ((bfd *, int));
static unsigned int pe_as32 PARAMS ((void *));
@ -988,7 +990,7 @@ static struct sec *current_sec;
void
pe_walk_relocs_of_symbol (info, name, cb)
struct bfd_link_info *info;
CONST char *name;
const char *name;
int (*cb) (arelent *, asection *);
{
bfd *b;
@ -1474,9 +1476,9 @@ quick_section (abfd, name, flags, align)
static void
quick_symbol (abfd, n1, n2, n3, sec, flags, addr)
bfd *abfd;
char *n1;
char *n2;
char *n3;
const char *n1;
const char *n2;
const char *n3;
asection *sec;
int flags;
int addr;
@ -1893,7 +1895,7 @@ make_one (exp, parent)
static bfd *
make_singleton_name_thunk (import, parent)
char *import;
const char *import;
bfd *parent;
{
/* Name thunks go to idata$4. */
@ -1941,7 +1943,7 @@ make_import_fixup_mark (rel)
/* We convert reloc to symbol, for later reference. */
static int counter;
static char *fixup_name = NULL;
static unsigned int buffer_len = 0;
static size_t buffer_len = 0;
struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
@ -1989,9 +1991,9 @@ make_import_fixup_mark (rel)
static bfd *
make_import_fixup_entry (name, fixup_name, dll_symname,parent)
char *name;
char *fixup_name;
char *dll_symname;
const char *name;
const char *fixup_name;
const char *dll_symname;
bfd *parent;
{
asection *id3;
@ -2046,7 +2048,7 @@ pe_create_import_fixup (rel)
char buf[300];
struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
struct bfd_link_hash_entry *name_thunk_sym;
CONST char *name = sym->name;
const char *name = sym->name;
char *fixup_name = make_import_fixup_mark (rel);
sprintf (buf, U ("_nm_thnk_%s"), name);
@ -2149,7 +2151,7 @@ pe_dll_generate_implib (def, impfilename)
static void
add_bfd_to_link (abfd, name, link_info)
bfd *abfd;
CONST char *name;
const char *name;
struct bfd_link_info *link_info;
{
lang_input_statement_type *fake_file;
@ -2250,8 +2252,8 @@ pe_get16 (abfd, where)
{
unsigned char b[2];
bfd_seek (abfd, where, SEEK_SET);
bfd_read (b, 1, 2, abfd);
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
bfd_bread (b, (bfd_size_type) 2, abfd);
return b[0] + (b[1] << 8);
}
@ -2262,8 +2264,8 @@ pe_get32 (abfd, where)
{
unsigned char b[4];
bfd_seek (abfd, where, SEEK_SET);
bfd_read (b, 1, 4, abfd);
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
bfd_bread (b, (bfd_size_type) 4, abfd);
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
}
@ -2343,8 +2345,8 @@ pe_implied_import_dll (filename)
unsigned long vsize = pe_get32 (dll, secptr1 + 16);
unsigned long fptr = pe_get32 (dll, secptr1 + 20);
bfd_seek (dll, secptr1, SEEK_SET);
bfd_read (sname, 1, 8, dll);
bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
bfd_bread (sname, (bfd_size_type) 8, dll);
if (vaddr <= export_rva && vaddr + vsize > export_rva)
{
@ -2356,8 +2358,8 @@ pe_implied_import_dll (filename)
}
expdata = (unsigned char *) xmalloc (export_size);
bfd_seek (dll, expptr, SEEK_SET);
bfd_read (expdata, 1, export_size, dll);
bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
bfd_bread (expdata, (bfd_size_type) export_size, dll);
erva = expdata - export_rva;
if (pe_def_file == 0)