* opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): Add

"_bfd_" to function names.
	* archive.c (_bfd_create_empty_archive_element_shell),
	libbfd-in.h: Change callers.

	* libbfd.c (bfd_zmalloc): Renamed from zalloc.
	* libbfd.c (bfd_add_to_string_table),
	trad-core.c (trad_unix_core_file_p),
	targets.c (bfd_target_list),
	ptrace-core.c (ptrace_unix_core_file_p),
	opncls.c (new_bfd), libbfd-in.h,
	ieee.c (ieee_make_empty_symbol),
	elf32-hppa.c (hppa_elf_stub_branch_reloc),
	(hppa_elf_stub_reloc): Change callers.
	* libbfd.h: Regenerated.

	* archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name.
	(_bfd_get_elt_at_filepos),
	coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h:
	Change callers.

	* format.c (bfd_check_format_matches), libbfd-in.h, targets.c,
	elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector
	and default_vector to bfd_default_vector.
	* libbfd.h: Regenerated.
This commit is contained in:
David MacKenzie
1994-01-25 13:25:26 +00:00
parent 2ba6182bbc
commit f4bd7a8f0e
11 changed files with 364 additions and 315 deletions

View File

@ -1,5 +1,31 @@
Mon Jan 24 14:41:23 1994 David J. Mackenzie (djm@thepub.cygnus.com) Mon Jan 24 14:41:23 1994 David J. Mackenzie (djm@thepub.cygnus.com)
* opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): Add
"_bfd_" to function names.
* archive.c (_bfd_create_empty_archive_element_shell),
libbfd-in.h: Change callers.
* libbfd.c (bfd_zmalloc): Renamed from zalloc.
* libbfd.c (bfd_add_to_string_table),
trad-core.c (trad_unix_core_file_p),
targets.c (bfd_target_list),
ptrace-core.c (ptrace_unix_core_file_p),
opncls.c (new_bfd), libbfd-in.h,
ieee.c (ieee_make_empty_symbol),
elf32-hppa.c (hppa_elf_stub_branch_reloc),
(hppa_elf_stub_reloc): Change callers.
* libbfd.h: Regenerated.
* archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name.
(_bfd_get_elt_at_filepos),
coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h:
Change callers.
* format.c (bfd_check_format_matches), libbfd-in.h, targets.c,
elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector
and default_vector to bfd_default_vector.
* libbfd.h: Regenerated.
* format.c (bfd_check_format_matches): New function. * format.c (bfd_check_format_matches): New function.
(bfd_check_format): Call it. (bfd_check_format): Call it.
(bfd_matching_formats): Function removed. (bfd_matching_formats): Function removed.

View File

@ -1,5 +1,5 @@
/* BFD back-end for archive files (libraries). /* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Copyright 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -254,7 +254,7 @@ _bfd_create_empty_archive_element_shell (obfd)
{ {
bfd *nbfd; bfd *nbfd;
nbfd = new_bfd_contained_in(obfd); nbfd = _bfd_new_bfd_contained_in(obfd);
if (nbfd == NULL) if (nbfd == NULL)
{ {
bfd_error = no_memory; bfd_error = no_memory;
@ -286,7 +286,7 @@ bfd_set_archive_head (output_archive, new_head)
} }
bfd * bfd *
look_for_bfd_in_cache (arch_bfd, filepos) _bfd_look_for_bfd_in_cache (arch_bfd, filepos)
bfd *arch_bfd; bfd *arch_bfd;
file_ptr filepos; file_ptr filepos;
{ {
@ -493,7 +493,7 @@ _bfd_get_elt_at_filepos (archive, filepos)
struct areltdata *new_areldata; struct areltdata *new_areldata;
bfd *n_nfd; bfd *n_nfd;
n_nfd = look_for_bfd_in_cache (archive, filepos); n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd) if (n_nfd)
return n_nfd; return n_nfd;
@ -740,8 +740,7 @@ do_slurp_coff_armap (abfd)
unsigned int parsed_size; unsigned int parsed_size;
carsym *carsyms; carsym *carsyms;
unsigned int nsymz; /* Number of symbols in armap. */ unsigned int nsymz; /* Number of symbols in armap. */
bfd_vma (*swap) PARAMS ((const bfd_byte*));
bfd_vma (*swap) PARAMS ((bfd_byte*));
char int_buf[sizeof(long)]; char int_buf[sizeof(long)];
unsigned int carsym_size, ptrsize, i; unsigned int carsym_size, ptrsize, i;

View File

@ -1,6 +1,11 @@
/* IBM RS/6000 "XCOFF" back-end for BFD. /* BFD back-end for IBM RS/6000 "XCOFF" files.
Copyright (C) 1990, 1991 Free Software Foundation, Inc. Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Metin G. Ozisik, Mimi Ph<50><68>ng-Th<54>o V<>, and John Gilmore. FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
them with octal escapes), and isn't useful without an understanding of what
character set it is.
Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
and John Gilmore.
Archive support from Damon A. Permezel. Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support. Contributed by IBM Corporation and Cygnus Support.
@ -40,7 +45,23 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* The main body of code is in coffcode.h. */ /* The main body of code is in coffcode.h. */
/* Can't read rs6000 relocs */ /* Can't read rs6000 relocs */
#define RTYPE2HOWTO(a,b) static reloc_howto_type dummy_reloc =
HOWTO (0, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"UNKNOWN", /* name */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false); /* pcrel_offset */
#define RTYPE2HOWTO(cache_ptr, dst) cache_ptr->howto = &dummy_reloc;
#include "coffcode.h" #include "coffcode.h"
#define coff_archive_p bfd_generic_archive_p #define coff_archive_p bfd_generic_archive_p
@ -168,7 +189,7 @@ rs6000coff_get_elt_at_filepos (archive, filepos)
struct areltdata *new_areldata; struct areltdata *new_areldata;
bfd *n_nfd; bfd *n_nfd;
n_nfd = look_for_bfd_in_cache (archive, filepos); n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd) return n_nfd; if (n_nfd) return n_nfd;
if (0 != bfd_seek (archive, filepos, SEEK_SET)) { if (0 != bfd_seek (archive, filepos, SEEK_SET)) {
@ -187,7 +208,7 @@ rs6000coff_get_elt_at_filepos (archive, filepos)
n_nfd->arelt_data = (PTR) new_areldata; n_nfd->arelt_data = (PTR) new_areldata;
n_nfd->filename = new_areldata->filename; n_nfd->filename = new_areldata->filename;
if (add_bfd_to_cache (archive, filepos, n_nfd)) if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
return n_nfd; return n_nfd;
/* huh? */ /* huh? */
@ -318,7 +339,7 @@ bfd_target rs6000coff_vec =
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG | HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT), HAS_SYMS | HAS_LOCALS | WP_TEXT),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
0, /* leading char */ 0, /* leading char */
@ -326,8 +347,12 @@ bfd_target rs6000coff_vec =
15, /* ar_max_namelen??? FIXMEmgo */ 15, /* ar_max_namelen??? FIXMEmgo */
3, /* default alignment power */ 3, /* default alignment power */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
coff_archive_p, coff_archive_p,
@ -343,5 +368,5 @@ bfd_target rs6000coff_vec =
_bfd_write_archive_contents, bfd_false}, _bfd_write_archive_contents, bfd_false},
JUMP_TABLE(coff), JUMP_TABLE(coff),
COFF_SWAP_TABLE COFF_SWAP_TABLE,
}; };

View File

@ -1,5 +1,5 @@
/* BFD back-end for HP PA-RISC ELF files. /* BFD back-end for HP PA-RISC ELF files.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Written by Written by
@ -193,13 +193,13 @@ static symext_chainS *symext_lastP;
static boolean symext_chain_built; static boolean symext_chain_built;
static unsigned long static unsigned long
DEFUN (hppa_elf_rebuild_insn, (abfd, insn, value, r_type, r_field, r_format), hppa_elf_rebuild_insn (abfd, insn, value, r_type, r_field, r_format)
bfd * abfd AND bfd *abfd;
unsigned long insn AND unsigned long insn;
unsigned long value AND unsigned long value;
unsigned short r_type AND unsigned short r_type;
unsigned short r_field AND unsigned short r_field;
unsigned short r_format) unsigned short r_format;
{ {
unsigned long const_part; /* part of the instruction that does not change */ unsigned long const_part; /* part of the instruction that does not change */
unsigned long rebuilt_part; unsigned long rebuilt_part;
@ -260,21 +260,20 @@ DEFUN (hppa_elf_rebuild_insn, (abfd, insn, value, r_type, r_field, r_format),
} }
static unsigned long static unsigned long
DEFUN (hppa_elf_relocate_insn, hppa_elf_relocate_insn (abfd, input_sect,
(abfd, input_sect, insn, address, symp, sym_value, r_addend,
insn, address, symp, sym_value, r_addend, r_type, r_format, r_field, pcrel)
r_type, r_format, r_field, pcrel), bfd *abfd;
bfd * abfd AND asection *input_sect;
asection * input_sect AND unsigned long insn;
unsigned long insn AND unsigned long address;
unsigned long address AND asymbol *symp;
asymbol * symp AND long sym_value;
long sym_value AND long r_addend;
long r_addend AND unsigned short r_type;
unsigned short r_type AND unsigned short r_format;
unsigned short r_format AND unsigned short r_field;
unsigned short r_field AND unsigned char pcrel;
unsigned char pcrel)
{ {
unsigned char opcode = get_opcode (insn); unsigned char opcode = get_opcode (insn);
long constant_value; long constant_value;
@ -361,21 +360,20 @@ DEFUN (hppa_elf_relocate_insn,
} }
static void static void
DEFUN (hppa_elf_relocate_unwind_table, hppa_elf_relocate_unwind_table (abfd, input_sect,
(abfd, input_sect, data, address, symp, sym_value, r_addend,
data, address, symp, sym_value, r_addend, r_type, r_format, r_field, pcrel)
r_type, r_format, r_field, pcrel), bfd *abfd;
bfd * abfd AND asection *input_sect;
asection * input_sect AND PTR data;
PTR data AND unsigned long address;
unsigned long address AND asymbol *symp;
asymbol * symp AND long sym_value;
long sym_value AND long r_addend;
long r_addend AND unsigned short r_type;
unsigned short r_type AND unsigned short r_format;
unsigned short r_format AND unsigned short r_field;
unsigned short r_field AND unsigned char pcrel;
unsigned char pcrel)
{ {
bfd_byte *hit_data = address + (bfd_byte *) (data); bfd_byte *hit_data = address + (bfd_byte *) (data);
long start_offset; long start_offset;
@ -1729,10 +1727,10 @@ elf_hppa_reloc_type_lookup (arch, code)
void void
DEFUN (elf_hppa_tc_symbol, (abfd, symbolP, sym_idx), elf_hppa_tc_symbol (abfd, symbolP, sym_idx)
bfd * abfd AND bfd *abfd;
elf_symbol_type * symbolP AND elf_symbol_type *symbolP;
int sym_idx) int sym_idx;
{ {
symext_chainS *symextP; symext_chainS *symextP;
unsigned int arg_reloc; unsigned int arg_reloc;
@ -1778,9 +1776,9 @@ static symext_entryS *symextn_contents;
static unsigned int symextn_contents_real_size; static unsigned int symextn_contents_real_size;
void void
DEFUN (elf_hppa_tc_make_sections, (abfd, ignored), elf_hppa_tc_make_sections (abfd, ignored)
bfd * abfd AND bfd *abfd;
PTR ignored) PTR ignored;
{ {
symext_chainS *symextP; symext_chainS *symextP;
int size; int size;
@ -2268,7 +2266,7 @@ hppa_elf_stub_branch_reloc (stub_desc, /* the bfd */
{ {
stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR; stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR;
size = sizeof (arelent) * stub_desc->relocs_allocated_cnt; size = sizeof (arelent) * stub_desc->relocs_allocated_cnt;
stub_desc->stub_sec->relocation = (arelent *) zalloc (size); stub_desc->stub_sec->relocation = (arelent *) bfd_zmalloc (size);
} }
else else
{ {
@ -2301,11 +2299,11 @@ hppa_elf_stub_reloc (stub_desc, /* the bfd */
target_sym, /* the target symbol */ target_sym, /* the target symbol */
offset, /* the offset within the stub buffer (pre-calculated) */ offset, /* the offset within the stub buffer (pre-calculated) */
type) type)
elf32_hppa_stub_description *stub_desc; elf32_hppa_stub_description *stub_desc;
bfd *output_bfd; bfd *output_bfd;
asymbol *target_sym; asymbol *target_sym;
int offset; int offset;
elf32_hppa_reloc_type type; elf32_hppa_reloc_type type;
{ {
/* Allocate a new relocation entry. */ /* Allocate a new relocation entry. */
arelent relent; arelent relent;
@ -2318,7 +2316,7 @@ elf32_hppa_reloc_type type;
{ {
stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR; stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR;
size = sizeof (arelent) * stub_desc->relocs_allocated_cnt; size = sizeof (arelent) * stub_desc->relocs_allocated_cnt;
stub_desc->stub_sec->relocation = (arelent *) zalloc (size); stub_desc->stub_sec->relocation = (arelent *) bfd_zmalloc (size);
} }
else else
{ {
@ -3281,12 +3279,12 @@ int linker_stubs_max_size = 0;
#define STUB_ALLOC_INCR 100 #define STUB_ALLOC_INCR 100
boolean boolean
DEFUN (hppa_elf_set_section_contents, (abfd, section, location, offset, count), hppa_elf_set_section_contents (abfd, section, location, offset, count)
bfd * abfd AND bfd *abfd;
sec_ptr section AND sec_ptr section;
PTR location AND PTR location;
file_ptr offset AND file_ptr offset;
bfd_size_type count) bfd_size_type count;
{ {
if ( strcmp(section->name, ".hppa_linker_stubs") == 0 ) if ( strcmp(section->name, ".hppa_linker_stubs") == 0 )
{ {
@ -3398,19 +3396,19 @@ hppa_elf_get_section_contents (abfd, section, location, offset, count)
} }
static void static void
DEFUN (elf_info_to_howto, (abfd, cache_ptr, dst), elf_info_to_howto (abfd, cache_ptr, dst)
bfd * abfd AND bfd *abfd;
arelent * cache_ptr AND arelent *cache_ptr;
Elf32_Internal_Rela * dst) Elf32_Internal_Rela *dst;
{ {
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_HPPA_UNIMPLEMENTED); BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_HPPA_UNIMPLEMENTED);
cache_ptr->howto = &elf_hppa_howto_table[ELF32_R_TYPE(dst->r_info)]; cache_ptr->howto = &elf_hppa_howto_table[ELF32_R_TYPE(dst->r_info)];
} }
static void static void
DEFUN (elf32_hppa_backend_symbol_processing, (abfd, sym), elf32_hppa_backend_symbol_processing (abfd, sym)
bfd * abfd AND bfd *abfd;
asymbol * sym) asymbol *sym;
{ {
/* Is this a definition of $global$? If so, keep it because it will be /* Is this a definition of $global$? If so, keep it because it will be
needed if any relocations are performed. */ needed if any relocations are performed. */
@ -3436,10 +3434,10 @@ static struct elf32_hppa_symextn_map_struct *elf32_hppa_symextn_map;
static int elf32_hppa_symextn_map_size; static int elf32_hppa_symextn_map_size;
static boolean static boolean
DEFUN (elf32_hppa_backend_symbol_table_processing, (abfd, esyms,symcnt), elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
bfd * abfd AND bfd *abfd;
elf_symbol_type *esyms AND elf_symbol_type *esyms;
int symcnt) int symcnt;
{ {
Elf32_Internal_Shdr *symextn_hdr = bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME); Elf32_Internal_Shdr *symextn_hdr = bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME);
int i; int i;
@ -3516,9 +3514,9 @@ DEFUN (elf32_hppa_backend_symbol_table_processing, (abfd, esyms,symcnt),
#define elf_backend_symbol_table_processing elf32_hppa_backend_symbol_table_processing #define elf_backend_symbol_table_processing elf32_hppa_backend_symbol_table_processing
static boolean static boolean
DEFUN (elf32_hppa_backend_section_processing, (abfd, secthdr), elf32_hppa_backend_section_processing (abfd, secthdr)
bfd * abfd AND bfd *abfd;
Elf32_Internal_Shdr *secthdr) Elf32_Internal_Shdr *secthdr;
{ {
int i,j,k; int i,j,k;
@ -3572,10 +3570,10 @@ DEFUN (elf32_hppa_backend_section_processing, (abfd, secthdr),
#define elf_backend_section_processing elf32_hppa_backend_section_processing #define elf_backend_section_processing elf32_hppa_backend_section_processing
static boolean static boolean
DEFUN (elf32_hppa_backend_section_from_shdr, (abfd, hdr, name), elf32_hppa_backend_section_from_shdr (abfd, hdr, name)
bfd * abfd AND bfd *abfd;
Elf32_Internal_Shdr *hdr AND Elf32_Internal_Shdr *hdr;
char * name) char *name;
{ {
asection *newsect; asection *newsect;
@ -3620,10 +3618,10 @@ DEFUN (elf32_hppa_backend_section_from_shdr, (abfd, hdr, name),
#define elf_backend_section_from_shdr elf32_hppa_backend_section_from_shdr #define elf_backend_section_from_shdr elf32_hppa_backend_section_from_shdr
static boolean static boolean
DEFUN (elf32_hppa_backend_fake_sections, (abfd, secthdr, asect), elf32_hppa_backend_fake_sections (abfd, secthdr, asect)
bfd * abfd AND bfd *abfd;
Elf_Internal_Shdr *secthdr AND Elf_Internal_Shdr *secthdr;
asection *asect) asection *asect;
{ {
if ( strcmp(asect->name, ".hppa_symextn") == 0 ) if ( strcmp(asect->name, ".hppa_symextn") == 0 )
@ -3663,13 +3661,12 @@ DEFUN (elf32_hppa_backend_fake_sections, (abfd, secthdr, asect),
#define elf_backend_fake_sections elf32_hppa_backend_fake_sections #define elf_backend_fake_sections elf32_hppa_backend_fake_sections
static boolean static boolean
DEFUN (elf32_hppa_backend_section_from_bfd_section, (abfd, hdr, asect, retval), elf32_hppa_backend_section_from_bfd_section (abfd, hdr, asect, retval)
bfd *abfd AND bfd *abfd;
Elf32_Internal_Shdr *hdr AND Elf32_Internal_Shdr *hdr;
asection *asect AND asection *asect;
int *retval) int *retval;
{ {
if ( hdr->sh_type == SHT_HPPA_SYMEXTN ) if ( hdr->sh_type == SHT_HPPA_SYMEXTN )
{ {
if (hdr->rawdata) if (hdr->rawdata)

View File

@ -897,7 +897,7 @@ DEFUN (elf_object_p, (abfd), bfd * abfd)
/* This is the generic ELF target. Let it match any ELF target /* This is the generic ELF target. Let it match any ELF target
for which we do not have a specific backend. */ for which we do not have a specific backend. */
for (target_ptr = target_vector; *target_ptr != NULL; target_ptr++) for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
{ {
struct elf_backend_data *back; struct elf_backend_data *back;

View File

@ -1,5 +1,5 @@
/* Generic BFD support for file formats. /* Generic BFD support for file formats.
Copyright (C) 1990-1991 Free Software Foundation, Inc. Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -45,7 +45,7 @@ SECTION
#include "libbfd.h" #include "libbfd.h"
/* IMPORT from targets.c. */ /* IMPORT from targets.c. */
extern CONST size_t bfd_default_vector_entries; extern CONST size_t _bfd_target_vector_entries;
/* /*
FUNCTION FUNCTION
@ -142,7 +142,7 @@ bfd_check_format_matches (abfd, format, matching)
{ {
*matching = matching_vector = *matching = matching_vector =
bfd_xmalloc_by_size_t (sizeof (char *) * bfd_xmalloc_by_size_t (sizeof (char *) *
(bfd_default_vector_entries + 1)); (_bfd_target_vector_entries + 1));
matching_vector[0] = NULL; matching_vector[0] = NULL;
} }
right_targ = 0; right_targ = 0;
@ -165,7 +165,7 @@ bfd_check_format_matches (abfd, format, matching)
} }
} }
for (target = target_vector; *target != NULL; target++) { for (target = bfd_target_vector; *target != NULL; target++) {
bfd_target *temp; bfd_target *temp;
abfd->xvec = *target; /* Change BFD's target temporarily */ abfd->xvec = *target; /* Change BFD's target temporarily */
@ -186,7 +186,7 @@ bfd_check_format_matches (abfd, format, matching)
/* If this is the default target, accept it, even if other targets /* If this is the default target, accept it, even if other targets
might match. People who want those other targets have to set might match. People who want those other targets have to set
the GNUTARGET variable. */ the GNUTARGET variable. */
if (temp == default_vector[0]) if (temp == bfd_default_vector[0])
{ {
match_count = 1; match_count = 1;
if (matching) if (matching)

View File

@ -2823,7 +2823,7 @@ DEFUN(ieee_make_empty_symbol,(abfd),
{ {
ieee_symbol_type *new = ieee_symbol_type *new =
(ieee_symbol_type *)zalloc (sizeof (ieee_symbol_type)); (ieee_symbol_type *)bfd_zmalloc (sizeof (ieee_symbol_type));
new->symbol.the_bfd = abfd; new->symbol.the_bfd = abfd;
return &new->symbol; return &new->symbol;
@ -2979,11 +2979,13 @@ DEFUN(ieee_bfd_debug_info_accumulate,(abfd, section),
#define ieee_set_arch_mach bfd_default_set_arch_mach #define ieee_set_arch_mach bfd_default_set_arch_mach
#define ieee_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define ieee_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define ieee_bfd_relax_section bfd_generic_relax_section #define ieee_bfd_relax_section bfd_generic_relax_section
#define ieee_bfd_seclet_link bfd_generic_seclet_link
#define ieee_bfd_reloc_type_lookup \ #define ieee_bfd_reloc_type_lookup \
((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr) ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
#define ieee_bfd_make_debug_symbol \ #define ieee_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_final_link _bfd_generic_final_link
/*SUPPRESS 460 */ /*SUPPRESS 460 */
bfd_target ieee_vec = bfd_target ieee_vec =
@ -2994,7 +2996,7 @@ bfd_target ieee_vec =
true, /* target headers byte order */ true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */ (HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG | HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
( SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS ( SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ |SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
0, /* leading underscore */ 0, /* leading underscore */

View File

@ -73,7 +73,7 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
char *zalloc PARAMS ((bfd_size_type size)); char *bfd_zmalloc PARAMS ((bfd_size_type size));
/* These routines allocate and free things on the BFD's obstack. Note /* These routines allocate and free things on the BFD's obstack. Note
that realloc can never occur in place. */ that realloc can never occur in place. */
@ -100,7 +100,7 @@ int bfd_flush PARAMS ((bfd *abfd));
int bfd_stat PARAMS ((bfd *abfd, struct stat *)); int bfd_stat PARAMS ((bfd *abfd, struct stat *));
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
bfd * look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
struct areltdata * _bfd_snarf_ar_hdr PARAMS ((bfd *abfd)); struct areltdata * _bfd_snarf_ar_hdr PARAMS ((bfd *abfd));
@ -111,7 +111,8 @@ boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
#define bfd_slurp_coff_armap bfd_slurp_armap #define bfd_slurp_coff_armap bfd_slurp_armap
boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
bfd * new_bfd PARAMS ((void)); bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
bfd * _bfd_new_bfd PARAMS ((void));
#define DEFAULT_STRING_SPACE_SIZE 0x2000 #define DEFAULT_STRING_SPACE_SIZE 0x2000
boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string, boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string,
@ -125,7 +126,7 @@ int bfd_0 PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore)); unsigned int bfd_0u PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore)); void bfd_void PARAMS ((bfd *ignore));
bfd * new_bfd_contained_in PARAMS ((bfd *)); bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect)); boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect));
char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd)); char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd));
int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd)); int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd));
@ -192,6 +193,7 @@ typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
extern boolean _bfd_generic_link_add_one_symbol extern boolean _bfd_generic_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
asection *, bfd_vma, const char *, boolean copy, asection *, bfd_vma, const char *, boolean copy,
boolean constructor, unsigned int bitsize,
struct bfd_link_hash_entry **)); struct bfd_link_hash_entry **));
/* Generic link routine. */ /* Generic link routine. */
@ -249,9 +251,9 @@ extern bfd *bfd_last_cache;
#define bfd_generic_close_and_cleanup bfd_true #define bfd_generic_close_and_cleanup bfd_true
/* List of supported target vectors, and the default vector (if /* List of supported target vectors, and the default vector (if
default_vector[0] is NULL, there is no default). */ bfd_default_vector[0] is NULL, there is no default). */
extern bfd_target *target_vector[]; extern bfd_target *bfd_target_vector[];
extern bfd_target *default_vector[]; extern bfd_target *bfd_default_vector[];
/* And more follows */ /* And more follows */

View File

@ -1,5 +1,5 @@
/* Assorted BFD support routines, only used internally. /* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Copyright 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -34,65 +34,65 @@ DESCRIPTION
/*ARGSUSED*/ /*ARGSUSED*/
boolean boolean
DEFUN(_bfd_dummy_new_section_hook,(ignore, ignore_newsect), _bfd_dummy_new_section_hook (ignore, ignore_newsect)
bfd *ignore AND bfd *ignore;
asection *ignore_newsect) asection *ignore_newsect;
{ {
return true; return true;
} }
/*ARGSUSED*/ /*ARGSUSED*/
boolean boolean
DEFUN(bfd_false ,(ignore), bfd_false (ignore)
bfd *ignore) bfd *ignore;
{ {
return false; return false;
} }
/*ARGSUSED*/ /*ARGSUSED*/
boolean boolean
DEFUN(bfd_true,(ignore), bfd_true (ignore)
bfd *ignore) bfd *ignore;
{ {
return true; return true;
} }
/*ARGSUSED*/ /*ARGSUSED*/
PTR PTR
DEFUN(bfd_nullvoidptr,(ignore), bfd_nullvoidptr (ignore)
bfd *ignore) bfd *ignore;
{ {
return (PTR)NULL; return (PTR)NULL;
} }
/*ARGSUSED*/ /*ARGSUSED*/
int int
DEFUN(bfd_0,(ignore), bfd_0 (ignore)
bfd *ignore) bfd *ignore;
{ {
return 0; return 0;
} }
/*ARGSUSED*/ /*ARGSUSED*/
unsigned int unsigned int
DEFUN(bfd_0u,(ignore), bfd_0u (ignore)
bfd *ignore) bfd *ignore;
{ {
return 0; return 0;
} }
/*ARGSUSED*/ /*ARGSUSED*/
void void
DEFUN(bfd_void,(ignore), bfd_void (ignore)
bfd *ignore) bfd *ignore;
{ {
} }
/*ARGSUSED*/ /*ARGSUSED*/
boolean boolean
DEFUN(_bfd_dummy_core_file_matches_executable_p,(ignore_core_bfd, ignore_exec_bfd), _bfd_dummy_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
bfd *ignore_core_bfd AND bfd *ignore_core_bfd;
bfd *ignore_exec_bfd) bfd *ignore_exec_bfd;
{ {
bfd_error = invalid_operation; bfd_error = invalid_operation;
return false; return false;
@ -102,35 +102,35 @@ DEFUN(_bfd_dummy_core_file_matches_executable_p,(ignore_core_bfd, ignore_exec_bf
/*ARGSUSED*/ /*ARGSUSED*/
char * char *
DEFUN(_bfd_dummy_core_file_failing_command,(ignore_abfd), _bfd_dummy_core_file_failing_command (ignore_abfd)
bfd *ignore_abfd) bfd *ignore_abfd;
{ {
return (char *)NULL; return (char *)NULL;
} }
/*ARGSUSED*/ /*ARGSUSED*/
int int
DEFUN(_bfd_dummy_core_file_failing_signal,(ignore_abfd), _bfd_dummy_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd) bfd *ignore_abfd;
{ {
return 0; return 0;
} }
/*ARGSUSED*/ /*ARGSUSED*/
bfd_target * bfd_target *
DEFUN(_bfd_dummy_target,(ignore_abfd), _bfd_dummy_target (ignore_abfd)
bfd *ignore_abfd) bfd *ignore_abfd;
{ {
return 0; return 0;
} }
/** zalloc -- allocate and clear storage */
#ifndef bfd_zmalloc
/* allocate and clear storage */
#ifndef zalloc
char * char *
DEFUN(zalloc,(size), bfd_zmalloc (size)
bfd_size_type size) bfd_size_type size;
{ {
char *ptr = (char *) malloc ((size_t)size); char *ptr = (char *) malloc ((size_t)size);
@ -139,7 +139,7 @@ DEFUN(zalloc,(size),
return ptr; return ptr;
} }
#endif #endif /* bfd_zmalloc */
/* /*
INTERNAL_FUNCTION INTERNAL_FUNCTION
@ -158,8 +158,9 @@ DESCRIPTION
However, obstack routines can't do this ... */ However, obstack routines can't do this ... */
DEFUN(PTR bfd_xmalloc,(size), PTR
bfd_size_type size) bfd_xmalloc (size)
bfd_size_type size;
{ {
static CONST char no_memory_message[] = "Virtual memory exhausted!\n"; static CONST char no_memory_message[] = "Virtual memory exhausted!\n";
PTR ptr; PTR ptr;
@ -185,8 +186,8 @@ DESCRIPTION
Uses <<size_t>>, so it's suitable for use as <<obstack_chunk_alloc>>. Uses <<size_t>>, so it's suitable for use as <<obstack_chunk_alloc>>.
*/ */
PTR PTR
DEFUN(bfd_xmalloc_by_size_t, (size), bfd_xmalloc_by_size_t (size)
size_t size) size_t size;
{ {
return bfd_xmalloc ((bfd_size_type) size); return bfd_xmalloc ((bfd_size_type) size);
} }
@ -202,20 +203,22 @@ DEFUN(bfd_xmalloc_by_size_t, (size),
first octet in the file, NOT the beginning of the archive header. */ first octet in the file, NOT the beginning of the archive header. */
static static
int DEFUN(real_read,(where, a,b, file), int
PTR where AND real_read (where, a,b, file)
int a AND PTR where;
int b AND int a;
FILE *file) int b;
FILE *file;
{ {
return fread(where, a,b,file); return fread(where, a,b,file);
} }
bfd_size_type bfd_size_type
DEFUN(bfd_read,(ptr, size, nitems, abfd), bfd_read (ptr, size, nitems, abfd)
PTR ptr AND PTR ptr;
bfd_size_type size AND bfd_size_type size;
bfd_size_type nitems AND bfd_size_type nitems;
bfd *abfd) bfd *abfd;
{ {
int nread; int nread;
nread = real_read (ptr, 1, (int)(size*nitems), bfd_cache_lookup(abfd)); nread = real_read (ptr, 1, (int)(size*nitems), bfd_cache_lookup(abfd));
@ -263,9 +266,9 @@ DESCRIPTION
*/ */
void void
DEFUN(bfd_write_bigendian_4byte_int,(abfd, i), bfd_write_bigendian_4byte_int (abfd, i)
bfd *abfd AND bfd *abfd;
int i) int i;
{ {
bfd_byte buffer[4]; bfd_byte buffer[4];
bfd_putb32(i, buffer); bfd_putb32(i, buffer);
@ -273,8 +276,8 @@ DEFUN(bfd_write_bigendian_4byte_int,(abfd, i),
} }
long long
DEFUN(bfd_tell,(abfd), bfd_tell (abfd)
bfd *abfd) bfd *abfd;
{ {
file_ptr ptr; file_ptr ptr;
@ -287,25 +290,25 @@ DEFUN(bfd_tell,(abfd),
} }
int int
DEFUN(bfd_flush,(abfd), bfd_flush (abfd)
bfd *abfd) bfd *abfd;
{ {
return fflush (bfd_cache_lookup(abfd)); return fflush (bfd_cache_lookup(abfd));
} }
int int
DEFUN(bfd_stat,(abfd, statbuf), bfd_stat (abfd, statbuf)
bfd *abfd AND bfd *abfd;
struct stat *statbuf) struct stat *statbuf;
{ {
return fstat (fileno(bfd_cache_lookup(abfd)), statbuf); return fstat (fileno(bfd_cache_lookup(abfd)), statbuf);
} }
int int
DEFUN(bfd_seek,(abfd, position, direction), bfd_seek (abfd, position, direction)
bfd * CONST abfd AND bfd * CONST abfd;
CONST file_ptr position AND CONST file_ptr position;
CONST int direction) CONST int direction;
{ {
int result; int result;
FILE *f; FILE *f;
@ -388,11 +391,11 @@ DEFUN(bfd_seek,(abfd, position, direction),
table_length). Updates free_ptr, table, table_length */ table_length). Updates free_ptr, table, table_length */
boolean boolean
DEFUN(bfd_add_to_string_table,(table, new_string, table_length, free_ptr), bfd_add_to_string_table (table, new_string, table_length, free_ptr)
char **table AND char **table;
char *new_string AND char *new_string;
unsigned int *table_length AND unsigned int *table_length;
char **free_ptr) char **free_ptr;
{ {
size_t string_length = strlen (new_string) + 1; /* include null here */ size_t string_length = strlen (new_string) + 1; /* include null here */
char *base = *table; char *base = *table;
@ -401,10 +404,10 @@ DEFUN(bfd_add_to_string_table,(table, new_string, table_length, free_ptr),
if (base == NULL) { if (base == NULL) {
/* Avoid a useless regrow if we can (but of course we still /* Avoid a useless regrow if we can (but of course we still
take it next time */ take it next time). */
space_length = (string_length < DEFAULT_STRING_SPACE_SIZE ? space_length = (string_length < DEFAULT_STRING_SPACE_SIZE ?
DEFAULT_STRING_SPACE_SIZE : string_length+1); DEFAULT_STRING_SPACE_SIZE : string_length+1);
base = zalloc ((bfd_size_type) space_length); base = bfd_zmalloc ((bfd_size_type) space_length);
if (base == NULL) { if (base == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
@ -569,86 +572,86 @@ DESCRIPTION
(((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION) (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
bfd_vma bfd_vma
DEFUN(bfd_getb16,(addr), bfd_getb16 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
return (addr[0] << 8) | addr[1]; return (addr[0] << 8) | addr[1];
} }
bfd_vma bfd_vma
DEFUN(bfd_getl16,(addr), bfd_getl16 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
return (addr[1] << 8) | addr[0]; return (addr[1] << 8) | addr[0];
} }
bfd_signed_vma bfd_signed_vma
DEFUN(bfd_getb_signed_16,(addr), bfd_getb_signed_16 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
return COERCE16((addr[0] << 8) | addr[1]); return COERCE16((addr[0] << 8) | addr[1]);
} }
bfd_signed_vma bfd_signed_vma
DEFUN(bfd_getl_signed_16,(addr), bfd_getl_signed_16 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
return COERCE16((addr[1] << 8) | addr[0]); return COERCE16((addr[1] << 8) | addr[0]);
} }
void void
DEFUN(bfd_putb16,(data, addr), bfd_putb16 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
addr[0] = (bfd_byte)(data >> 8); addr[0] = (bfd_byte)(data >> 8);
addr[1] = (bfd_byte )data; addr[1] = (bfd_byte )data;
} }
void void
DEFUN(bfd_putl16,(data, addr), bfd_putl16 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
addr[0] = (bfd_byte )data; addr[0] = (bfd_byte )data;
addr[1] = (bfd_byte)(data >> 8); addr[1] = (bfd_byte)(data >> 8);
} }
bfd_vma bfd_vma
bfd_getb32 (addr) bfd_getb32 (addr)
register bfd_byte *addr; register const bfd_byte *addr;
{ {
return (((((bfd_vma)addr[0] << 8) | addr[1]) << 8) return (((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
| addr[2]) << 8 | addr[3]; | addr[2]) << 8 | addr[3];
} }
bfd_vma bfd_vma
bfd_getl32 (addr) bfd_getl32 (addr)
register bfd_byte *addr; register const bfd_byte *addr;
{ {
return (((((bfd_vma)addr[3] << 8) | addr[2]) << 8) return (((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
| addr[1]) << 8 | addr[0]; | addr[1]) << 8 | addr[0];
} }
bfd_signed_vma bfd_signed_vma
bfd_getb_signed_32 (addr) bfd_getb_signed_32 (addr)
register bfd_byte *addr; register const bfd_byte *addr;
{ {
return COERCE32((((((bfd_vma)addr[0] << 8) | addr[1]) << 8) return COERCE32((((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
| addr[2]) << 8 | addr[3]); | addr[2]) << 8 | addr[3]);
} }
bfd_signed_vma bfd_signed_vma
bfd_getl_signed_32 (addr) bfd_getl_signed_32 (addr)
register bfd_byte *addr; register const bfd_byte *addr;
{ {
return COERCE32((((((bfd_vma)addr[3] << 8) | addr[2]) << 8) return COERCE32((((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
| addr[1]) << 8 | addr[0]); | addr[1]) << 8 | addr[0]);
} }
bfd_vma bfd_vma
DEFUN(bfd_getb64,(addr), bfd_getb64 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
bfd_vma low, high; bfd_vma low, high;
@ -668,14 +671,12 @@ DEFUN(bfd_getb64,(addr),
BFD_FAIL(); BFD_FAIL();
return 0; return 0;
#endif #endif
} }
bfd_vma bfd_vma
DEFUN(bfd_getl64,(addr), bfd_getl64 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
bfd_vma low, high; bfd_vma low, high;
high= (((((((addr[7] << 8) | high= (((((((addr[7] << 8) |
@ -697,8 +698,8 @@ DEFUN(bfd_getl64,(addr),
} }
bfd_signed_vma bfd_signed_vma
DEFUN(bfd_getb_signed_64,(addr), bfd_getb_signed_64 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
bfd_vma low, high; bfd_vma low, high;
@ -718,14 +719,12 @@ DEFUN(bfd_getb_signed_64,(addr),
BFD_FAIL(); BFD_FAIL();
return 0; return 0;
#endif #endif
} }
bfd_signed_vma bfd_signed_vma
DEFUN(bfd_getl_signed_64,(addr), bfd_getl_signed_64 (addr)
register bfd_byte *addr) register const bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
bfd_vma low, high; bfd_vma low, high;
high= (((((((addr[7] << 8) | high= (((((((addr[7] << 8) |
@ -743,13 +742,12 @@ DEFUN(bfd_getl_signed_64,(addr),
BFD_FAIL(); BFD_FAIL();
return 0; return 0;
#endif #endif
} }
void void
DEFUN(bfd_putb32,(data, addr), bfd_putb32 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
addr[0] = (bfd_byte)(data >> 24); addr[0] = (bfd_byte)(data >> 24);
addr[1] = (bfd_byte)(data >> 16); addr[1] = (bfd_byte)(data >> 16);
@ -758,19 +756,20 @@ DEFUN(bfd_putb32,(data, addr),
} }
void void
DEFUN(bfd_putl32,(data, addr), bfd_putl32 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
addr[0] = (bfd_byte)data; addr[0] = (bfd_byte)data;
addr[1] = (bfd_byte)(data >> 8); addr[1] = (bfd_byte)(data >> 8);
addr[2] = (bfd_byte)(data >> 16); addr[2] = (bfd_byte)(data >> 16);
addr[3] = (bfd_byte)(data >> 24); addr[3] = (bfd_byte)(data >> 24);
} }
void void
DEFUN(bfd_putb64,(data, addr), bfd_putb64 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
addr[0] = (bfd_byte)(data >> (7*8)); addr[0] = (bfd_byte)(data >> (7*8));
@ -784,13 +783,12 @@ DEFUN(bfd_putb64,(data, addr),
#else #else
BFD_FAIL(); BFD_FAIL();
#endif #endif
} }
void void
DEFUN(bfd_putl64,(data, addr), bfd_putl64 (data, addr)
bfd_vma data AND bfd_vma data;
register bfd_byte *addr) register bfd_byte *addr;
{ {
#ifdef BFD64 #ifdef BFD64
addr[7] = (bfd_byte)(data >> (7*8)); addr[7] = (bfd_byte)(data >> (7*8));
@ -804,19 +802,17 @@ DEFUN(bfd_putl64,(data, addr),
#else #else
BFD_FAIL(); BFD_FAIL();
#endif #endif
} }
/* Default implementation */ /* Default implementation */
boolean boolean
DEFUN(bfd_generic_get_section_contents, (abfd, section, location, offset, count), bfd_generic_get_section_contents (abfd, section, location, offset, count)
bfd *abfd AND bfd *abfd;
sec_ptr section AND sec_ptr section;
PTR location AND PTR location;
file_ptr offset AND file_ptr offset;
bfd_size_type count) bfd_size_type count;
{ {
if (count == 0) if (count == 0)
return true; return true;
@ -842,12 +838,6 @@ bfd_generic_set_section_contents (abfd, section, location, offset, count)
if (count == 0) if (count == 0)
return true; return true;
if (offset + count > bfd_get_section_size_after_reloc (section))
{
bfd_error = bad_value;
return false;
}
if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1 if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1
|| bfd_write (location, (bfd_size_type) 1, count, abfd) != count) || bfd_write (location, (bfd_size_type) 1, count, abfd) != count)
return false; return false;

View File

@ -73,7 +73,7 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
char *zalloc PARAMS ((bfd_size_type size)); char *bfd_zmalloc PARAMS ((bfd_size_type size));
/* These routines allocate and free things on the BFD's obstack. Note /* These routines allocate and free things on the BFD's obstack. Note
that realloc can never occur in place. */ that realloc can never occur in place. */
@ -100,7 +100,7 @@ int bfd_flush PARAMS ((bfd *abfd));
int bfd_stat PARAMS ((bfd *abfd, struct stat *)); int bfd_stat PARAMS ((bfd *abfd, struct stat *));
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
bfd * look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
struct areltdata * _bfd_snarf_ar_hdr PARAMS ((bfd *abfd)); struct areltdata * _bfd_snarf_ar_hdr PARAMS ((bfd *abfd));
@ -111,7 +111,8 @@ boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
#define bfd_slurp_coff_armap bfd_slurp_armap #define bfd_slurp_coff_armap bfd_slurp_armap
boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
bfd * new_bfd PARAMS ((void)); bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
bfd * _bfd_new_bfd PARAMS ((void));
#define DEFAULT_STRING_SPACE_SIZE 0x2000 #define DEFAULT_STRING_SPACE_SIZE 0x2000
boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string, boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string,
@ -125,7 +126,7 @@ int bfd_0 PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore)); unsigned int bfd_0u PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore)); void bfd_void PARAMS ((bfd *ignore));
bfd * new_bfd_contained_in PARAMS ((bfd *)); bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect)); boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect));
char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd)); char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd));
int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd)); int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd));
@ -192,6 +193,7 @@ typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
extern boolean _bfd_generic_link_add_one_symbol extern boolean _bfd_generic_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
asection *, bfd_vma, const char *, boolean copy, asection *, bfd_vma, const char *, boolean copy,
boolean constructor, unsigned int bitsize,
struct bfd_link_hash_entry **)); struct bfd_link_hash_entry **));
/* Generic link routine. */ /* Generic link routine. */
@ -249,9 +251,9 @@ extern bfd *bfd_last_cache;
#define bfd_generic_close_and_cleanup bfd_true #define bfd_generic_close_and_cleanup bfd_true
/* List of supported target vectors, and the default vector (if /* List of supported target vectors, and the default vector (if
default_vector[0] is NULL, there is no default). */ bfd_default_vector[0] is NULL, there is no default). */
extern bfd_target *target_vector[]; extern bfd_target *bfd_target_vector[];
extern bfd_target *default_vector[]; extern bfd_target *bfd_default_vector[];
/* And more follows */ /* And more follows */

View File

@ -35,16 +35,16 @@ FILE *bfd_open_file PARAMS ((bfd *));
/* Return a new BFD. All BFD's are allocated through this routine. */ /* Return a new BFD. All BFD's are allocated through this routine. */
bfd * bfd *
new_bfd PARAMS ((void)) _bfd_new_bfd (void)
{ {
bfd *nbfd; bfd *nbfd;
nbfd = (bfd *)zalloc (sizeof (bfd)); nbfd = (bfd *)bfd_zmalloc (sizeof (bfd));
if (!nbfd) if (!nbfd)
return 0; return 0;
bfd_check_init(); bfd_check_init();
obstack_begin((PTR)&nbfd->memory, 128); obstack_begin(&nbfd->memory, 128);
nbfd->arch_info = &bfd_default_arch_struct; nbfd->arch_info = &bfd_default_arch_struct;
@ -69,12 +69,12 @@ new_bfd PARAMS ((void))
/* Allocate a new BFD as a member of archive OBFD. */ /* Allocate a new BFD as a member of archive OBFD. */
bfd * bfd *
new_bfd_contained_in (obfd) _bfd_new_bfd_contained_in (obfd)
bfd *obfd; bfd *obfd;
{ {
bfd *nbfd; bfd *nbfd;
nbfd = new_bfd(); nbfd = _bfd_new_bfd();
nbfd->xvec = obfd->xvec; nbfd->xvec = obfd->xvec;
nbfd->my_archive = obfd; nbfd->my_archive = obfd;
nbfd->direction = read_direction; nbfd->direction = read_direction;
@ -84,7 +84,7 @@ new_bfd_contained_in (obfd)
/* /*
SECTION SECTION
Opening and Closing BFDs Opening and closing BFDs
*/ */
@ -99,22 +99,22 @@ DESCRIPTION
Open the file @var{filename} (using <<fopen>>) with the target Open the file @var{filename} (using <<fopen>>) with the target
@var{target}. Return a pointer to the created BFD. @var{target}. Return a pointer to the created BFD.
If NULL is returned then an error has occured. Possible errors
are <<no_memory>>, <<invalid_target>> or <<system_call>> error.
Calls <<bfd_find_target>>, so @var{target} is interpreted as by Calls <<bfd_find_target>>, so @var{target} is interpreted as by
that function. that function.
If <<NULL>> is returned then an error has occured. Possible errors
are <<no_memory>>, <<invalid_target>> or <<system_call>> error.
*/ */
bfd * bfd *
DEFUN(bfd_openr, (filename, target), bfd_openr (filename, target)
CONST char *filename AND CONST char *filename;
CONST char *target) CONST char *target;
{ {
bfd *nbfd; bfd *nbfd;
bfd_target *target_vec; bfd_target *target_vec;
nbfd = new_bfd(); nbfd = _bfd_new_bfd();
if (nbfd == NULL) { if (nbfd == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
return NULL; return NULL;
@ -173,10 +173,10 @@ DESCRIPTION
*/ */
bfd * bfd *
DEFUN(bfd_fdopenr,(filename, target, fd), bfd_fdopenr (filename, target, fd)
CONST char *filename AND CONST char *filename;
CONST char *target AND CONST char *target;
int fd) int fd;
{ {
bfd *nbfd; bfd *nbfd;
bfd_target *target_vec; bfd_target *target_vec;
@ -191,7 +191,7 @@ DEFUN(bfd_fdopenr,(filename, target, fd),
#endif #endif
if (fdflags == -1) return NULL; if (fdflags == -1) return NULL;
nbfd = new_bfd(); nbfd = _bfd_new_bfd();
if (nbfd == NULL) { if (nbfd == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
@ -260,9 +260,9 @@ DESCRIPTION
*/ */
bfd * bfd *
DEFUN(bfd_openw,(filename, target), bfd_openw (filename, target)
CONST char *filename AND CONST char *filename;
CONST char *target) CONST char *target;
{ {
bfd *nbfd; bfd *nbfd;
bfd_target *target_vec; bfd_target *target_vec;
@ -272,7 +272,7 @@ DEFUN(bfd_openw,(filename, target),
/* nbfd has to point to head of malloc'ed block so that bfd_close may /* nbfd has to point to head of malloc'ed block so that bfd_close may
reclaim it correctly. */ reclaim it correctly. */
nbfd = new_bfd(); nbfd = _bfd_new_bfd();
if (nbfd == NULL) { if (nbfd == NULL) {
bfd_error = no_memory; bfd_error = no_memory;
return NULL; return NULL;
@ -318,8 +318,8 @@ RETURNS
boolean boolean
DEFUN(bfd_close,(abfd), bfd_close (abfd)
bfd *abfd) bfd *abfd;
{ {
boolean ret; boolean ret;
@ -379,8 +379,8 @@ RETURNS
*/ */
boolean boolean
DEFUN(bfd_close_all_done,(abfd), bfd_close_all_done (abfd)
bfd *abfd) bfd *abfd;
{ {
boolean ret; boolean ret;
@ -424,8 +424,8 @@ DESCRIPTION
*/ */
bfd_size_type bfd_size_type
DEFUN(bfd_alloc_size,(abfd), bfd_alloc_size (abfd)
bfd *abfd) bfd *abfd;
{ {
struct _obstack_chunk *chunk = abfd->memory.chunk; struct _obstack_chunk *chunk = abfd->memory.chunk;
size_t size = 0; size_t size = 0;
@ -454,11 +454,11 @@ DESCRIPTION
*/ */
bfd * bfd *
DEFUN(bfd_create,(filename, templ), bfd_create (filename, templ)
CONST char *filename AND CONST char *filename;
bfd *templ) bfd *templ;
{ {
bfd *nbfd = new_bfd(); bfd *nbfd = _bfd_new_bfd();
if (nbfd == (bfd *)NULL) { if (nbfd == (bfd *)NULL) {
bfd_error = no_memory; bfd_error = no_memory;
return (bfd *)NULL; return (bfd *)NULL;
@ -486,37 +486,42 @@ DESCRIPTION
PTR PTR
DEFUN(bfd_alloc_by_size_t,(abfd, size), bfd_alloc_by_size_t (abfd, size)
bfd *abfd AND bfd *abfd;
size_t size) size_t size;
{ {
PTR res = obstack_alloc(&(abfd->memory), size); PTR res = obstack_alloc(&(abfd->memory), size);
return res; return res;
} }
DEFUN(void bfd_alloc_grow,(abfd, ptr, size), void
bfd *abfd AND bfd_alloc_grow (abfd, ptr, size)
PTR ptr AND bfd *abfd;
size_t size) PTR ptr;
size_t size;
{ {
(void) obstack_grow(&(abfd->memory), ptr, size); (void) obstack_grow(&(abfd->memory), ptr, size);
} }
DEFUN(PTR bfd_alloc_finish,(abfd),
bfd *abfd) PTR
bfd_alloc_finish (abfd)
bfd *abfd;
{ {
return obstack_finish(&(abfd->memory)); return obstack_finish(&(abfd->memory));
} }
DEFUN(PTR bfd_alloc, (abfd, size), PTR
bfd *abfd AND bfd_alloc (abfd, size)
size_t size) bfd *abfd;
size_t size;
{ {
return bfd_alloc_by_size_t(abfd, (size_t)size); return bfd_alloc_by_size_t(abfd, (size_t)size);
} }
DEFUN(PTR bfd_zalloc,(abfd, size), PTR
bfd *abfd AND bfd_zalloc (abfd, size)
size_t size) bfd *abfd;
size_t size;
{ {
PTR res; PTR res;
res = bfd_alloc(abfd, size); res = bfd_alloc(abfd, size);
@ -524,10 +529,11 @@ DEFUN(PTR bfd_zalloc,(abfd, size),
return res; return res;
} }
DEFUN(PTR bfd_realloc,(abfd, old, size), PTR
bfd *abfd AND bfd_realloc (abfd, old, size)
PTR old AND bfd *abfd;
size_t size) PTR old;
size_t size;
{ {
PTR res = bfd_alloc(abfd, size); PTR res = bfd_alloc(abfd, size);
memcpy(res, old, (size_t)size); memcpy(res, old, (size_t)size);