* 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)
* 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.
(bfd_check_format): Call it.
(bfd_matching_formats): Function removed.

View File

@ -1,5 +1,5 @@
/* 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.
This file is part of BFD, the Binary File Descriptor library.
@ -254,7 +254,7 @@ _bfd_create_empty_archive_element_shell (obfd)
{
bfd *nbfd;
nbfd = new_bfd_contained_in(obfd);
nbfd = _bfd_new_bfd_contained_in(obfd);
if (nbfd == NULL)
{
bfd_error = no_memory;
@ -286,7 +286,7 @@ bfd_set_archive_head (output_archive, new_head)
}
bfd *
look_for_bfd_in_cache (arch_bfd, filepos)
_bfd_look_for_bfd_in_cache (arch_bfd, filepos)
bfd *arch_bfd;
file_ptr filepos;
{
@ -493,7 +493,7 @@ _bfd_get_elt_at_filepos (archive, filepos)
struct areltdata *new_areldata;
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;
@ -740,8 +740,7 @@ do_slurp_coff_armap (abfd)
unsigned int parsed_size;
carsym *carsyms;
unsigned int nsymz; /* Number of symbols in armap. */
bfd_vma (*swap) PARAMS ((bfd_byte*));
bfd_vma (*swap) PARAMS ((const bfd_byte*));
char int_buf[sizeof(long)];
unsigned int carsym_size, ptrsize, i;

View File

@ -1,6 +1,11 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Written by Metin G. Ozisik, Mimi Phûông-Thåo , and John Gilmore.
/* BFD back-end for IBM RS/6000 "XCOFF" files.
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
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.
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. */
/* 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"
#define coff_archive_p bfd_generic_archive_p
@ -168,7 +189,7 @@ rs6000coff_get_elt_at_filepos (archive, filepos)
struct areltdata *new_areldata;
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 (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->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;
/* huh? */
@ -318,7 +339,7 @@ bfd_target rs6000coff_vec =
(HAS_RELOC | EXEC_P | /* object flags */
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 */
0, /* leading char */
@ -326,8 +347,12 @@ bfd_target rs6000coff_vec =
15, /* ar_max_namelen??? FIXMEmgo */
3, /* default alignment power */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
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 */
coff_archive_p,
@ -343,5 +368,5 @@ bfd_target rs6000coff_vec =
_bfd_write_archive_contents, bfd_false},
JUMP_TABLE(coff),
COFF_SWAP_TABLE
COFF_SWAP_TABLE,
};

View File

@ -1,5 +1,5 @@
/* 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
@ -193,13 +193,13 @@ static symext_chainS *symext_lastP;
static boolean symext_chain_built;
static unsigned long
DEFUN (hppa_elf_rebuild_insn, (abfd, insn, value, r_type, r_field, r_format),
bfd * abfd AND
unsigned long insn AND
unsigned long value AND
unsigned short r_type AND
unsigned short r_field AND
unsigned short r_format)
hppa_elf_rebuild_insn (abfd, insn, value, r_type, r_field, r_format)
bfd *abfd;
unsigned long insn;
unsigned long value;
unsigned short r_type;
unsigned short r_field;
unsigned short r_format;
{
unsigned long const_part; /* part of the instruction that does not change */
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
DEFUN (hppa_elf_relocate_insn,
(abfd, input_sect,
insn, address, symp, sym_value, r_addend,
r_type, r_format, r_field, pcrel),
bfd * abfd AND
asection * input_sect AND
unsigned long insn AND
unsigned long address AND
asymbol * symp AND
long sym_value AND
long r_addend AND
unsigned short r_type AND
unsigned short r_format AND
unsigned short r_field AND
unsigned char pcrel)
hppa_elf_relocate_insn (abfd, input_sect,
insn, address, symp, sym_value, r_addend,
r_type, r_format, r_field, pcrel)
bfd *abfd;
asection *input_sect;
unsigned long insn;
unsigned long address;
asymbol *symp;
long sym_value;
long r_addend;
unsigned short r_type;
unsigned short r_format;
unsigned short r_field;
unsigned char pcrel;
{
unsigned char opcode = get_opcode (insn);
long constant_value;
@ -361,21 +360,20 @@ DEFUN (hppa_elf_relocate_insn,
}
static void
DEFUN (hppa_elf_relocate_unwind_table,
(abfd, input_sect,
data, address, symp, sym_value, r_addend,
r_type, r_format, r_field, pcrel),
bfd * abfd AND
asection * input_sect AND
PTR data AND
unsigned long address AND
asymbol * symp AND
long sym_value AND
long r_addend AND
unsigned short r_type AND
unsigned short r_format AND
unsigned short r_field AND
unsigned char pcrel)
hppa_elf_relocate_unwind_table (abfd, input_sect,
data, address, symp, sym_value, r_addend,
r_type, r_format, r_field, pcrel)
bfd *abfd;
asection *input_sect;
PTR data;
unsigned long address;
asymbol *symp;
long sym_value;
long r_addend;
unsigned short r_type;
unsigned short r_format;
unsigned short r_field;
unsigned char pcrel;
{
bfd_byte *hit_data = address + (bfd_byte *) (data);
long start_offset;
@ -1729,10 +1727,10 @@ elf_hppa_reloc_type_lookup (arch, code)
void
DEFUN (elf_hppa_tc_symbol, (abfd, symbolP, sym_idx),
bfd * abfd AND
elf_symbol_type * symbolP AND
int sym_idx)
elf_hppa_tc_symbol (abfd, symbolP, sym_idx)
bfd *abfd;
elf_symbol_type *symbolP;
int sym_idx;
{
symext_chainS *symextP;
unsigned int arg_reloc;
@ -1778,9 +1776,9 @@ static symext_entryS *symextn_contents;
static unsigned int symextn_contents_real_size;
void
DEFUN (elf_hppa_tc_make_sections, (abfd, ignored),
bfd * abfd AND
PTR ignored)
elf_hppa_tc_make_sections (abfd, ignored)
bfd *abfd;
PTR ignored;
{
symext_chainS *symextP;
int size;
@ -2268,7 +2266,7 @@ hppa_elf_stub_branch_reloc (stub_desc, /* the bfd */
{
stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR;
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
{
@ -2301,11 +2299,11 @@ hppa_elf_stub_reloc (stub_desc, /* the bfd */
target_sym, /* the target symbol */
offset, /* the offset within the stub buffer (pre-calculated) */
type)
elf32_hppa_stub_description *stub_desc;
bfd *output_bfd;
asymbol *target_sym;
int offset;
elf32_hppa_reloc_type type;
elf32_hppa_stub_description *stub_desc;
bfd *output_bfd;
asymbol *target_sym;
int offset;
elf32_hppa_reloc_type type;
{
/* Allocate a new relocation entry. */
arelent relent;
@ -2318,7 +2316,7 @@ elf32_hppa_reloc_type type;
{
stub_desc->relocs_allocated_cnt = STUB_RELOC_INCR;
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
{
@ -3281,12 +3279,12 @@ int linker_stubs_max_size = 0;
#define STUB_ALLOC_INCR 100
boolean
DEFUN (hppa_elf_set_section_contents, (abfd, section, location, offset, count),
bfd * abfd AND
sec_ptr section AND
PTR location AND
file_ptr offset AND
bfd_size_type count)
hppa_elf_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
PTR location;
file_ptr offset;
bfd_size_type count;
{
if ( strcmp(section->name, ".hppa_linker_stubs") == 0 )
{
@ -3398,19 +3396,19 @@ hppa_elf_get_section_contents (abfd, section, location, offset, count)
}
static void
DEFUN (elf_info_to_howto, (abfd, cache_ptr, dst),
bfd * abfd AND
arelent * cache_ptr AND
Elf32_Internal_Rela * dst)
elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd;
arelent *cache_ptr;
Elf32_Internal_Rela *dst;
{
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)];
}
static void
DEFUN (elf32_hppa_backend_symbol_processing, (abfd, sym),
bfd * abfd AND
asymbol * sym)
elf32_hppa_backend_symbol_processing (abfd, sym)
bfd *abfd;
asymbol *sym;
{
/* Is this a definition of $global$? If so, keep it because it will be
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 boolean
DEFUN (elf32_hppa_backend_symbol_table_processing, (abfd, esyms,symcnt),
bfd * abfd AND
elf_symbol_type *esyms AND
int symcnt)
elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
bfd *abfd;
elf_symbol_type *esyms;
int symcnt;
{
Elf32_Internal_Shdr *symextn_hdr = bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME);
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
static boolean
DEFUN (elf32_hppa_backend_section_processing, (abfd, secthdr),
bfd * abfd AND
Elf32_Internal_Shdr *secthdr)
elf32_hppa_backend_section_processing (abfd, secthdr)
bfd *abfd;
Elf32_Internal_Shdr *secthdr;
{
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
static boolean
DEFUN (elf32_hppa_backend_section_from_shdr, (abfd, hdr, name),
bfd * abfd AND
Elf32_Internal_Shdr *hdr AND
char * name)
elf32_hppa_backend_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf32_Internal_Shdr *hdr;
char *name;
{
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
static boolean
DEFUN (elf32_hppa_backend_fake_sections, (abfd, secthdr, asect),
bfd * abfd AND
Elf_Internal_Shdr *secthdr AND
asection *asect)
elf32_hppa_backend_fake_sections (abfd, secthdr, asect)
bfd *abfd;
Elf_Internal_Shdr *secthdr;
asection *asect;
{
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
static boolean
DEFUN (elf32_hppa_backend_section_from_bfd_section, (abfd, hdr, asect, retval),
bfd *abfd AND
Elf32_Internal_Shdr *hdr AND
asection *asect AND
int *retval)
elf32_hppa_backend_section_from_bfd_section (abfd, hdr, asect, retval)
bfd *abfd;
Elf32_Internal_Shdr *hdr;
asection *asect;
int *retval;
{
if ( hdr->sh_type == SHT_HPPA_SYMEXTN )
{
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
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;

View File

@ -1,5 +1,5 @@
/* 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.
This file is part of BFD, the Binary File Descriptor library.
@ -45,7 +45,7 @@ SECTION
#include "libbfd.h"
/* IMPORT from targets.c. */
extern CONST size_t bfd_default_vector_entries;
extern CONST size_t _bfd_target_vector_entries;
/*
FUNCTION
@ -142,7 +142,7 @@ bfd_check_format_matches (abfd, format, matching)
{
*matching = matching_vector =
bfd_xmalloc_by_size_t (sizeof (char *) *
(bfd_default_vector_entries + 1));
(_bfd_target_vector_entries + 1));
matching_vector[0] = NULL;
}
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;
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
might match. People who want those other targets have to set
the GNUTARGET variable. */
if (temp == default_vector[0])
if (temp == bfd_default_vector[0])
{
match_count = 1;
if (matching)

View File

@ -2823,7 +2823,7 @@ DEFUN(ieee_make_empty_symbol,(abfd),
{
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;
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_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define ieee_bfd_relax_section bfd_generic_relax_section
#define ieee_bfd_seclet_link bfd_generic_seclet_link
#define ieee_bfd_reloc_type_lookup \
((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
#define ieee_bfd_make_debug_symbol \
((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 */
bfd_target ieee_vec =
@ -2994,7 +2996,7 @@ bfd_target ieee_vec =
true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */
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_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
0, /* leading underscore */

View File

@ -73,7 +73,7 @@ struct areltdata {
#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
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 *));
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_generic_mkarchive 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
boolean _bfd_slurp_extended_name_table 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
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));
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));
char * _bfd_dummy_core_file_failing_command 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
PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, unsigned int bitsize,
struct bfd_link_hash_entry **));
/* Generic link routine. */
@ -249,9 +251,9 @@ extern bfd *bfd_last_cache;
#define bfd_generic_close_and_cleanup bfd_true
/* List of supported target vectors, and the default vector (if
default_vector[0] is NULL, there is no default). */
extern bfd_target *target_vector[];
extern bfd_target *default_vector[];
bfd_default_vector[0] is NULL, there is no default). */
extern bfd_target *bfd_target_vector[];
extern bfd_target *bfd_default_vector[];
/* And more follows */

View File

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

View File

@ -73,7 +73,7 @@ struct areltdata {
#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
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 *));
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_generic_mkarchive 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
boolean _bfd_slurp_extended_name_table 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
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));
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));
char * _bfd_dummy_core_file_failing_command 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
PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, unsigned int bitsize,
struct bfd_link_hash_entry **));
/* Generic link routine. */
@ -249,9 +251,9 @@ extern bfd *bfd_last_cache;
#define bfd_generic_close_and_cleanup bfd_true
/* List of supported target vectors, and the default vector (if
default_vector[0] is NULL, there is no default). */
extern bfd_target *target_vector[];
extern bfd_target *default_vector[];
bfd_default_vector[0] is NULL, there is no default). */
extern bfd_target *bfd_target_vector[];
extern bfd_target *bfd_default_vector[];
/* 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. */
bfd *
new_bfd PARAMS ((void))
_bfd_new_bfd (void)
{
bfd *nbfd;
nbfd = (bfd *)zalloc (sizeof (bfd));
nbfd = (bfd *)bfd_zmalloc (sizeof (bfd));
if (!nbfd)
return 0;
bfd_check_init();
obstack_begin((PTR)&nbfd->memory, 128);
obstack_begin(&nbfd->memory, 128);
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. */
bfd *
new_bfd_contained_in (obfd)
_bfd_new_bfd_contained_in (obfd)
bfd *obfd;
{
bfd *nbfd;
nbfd = new_bfd();
nbfd = _bfd_new_bfd();
nbfd->xvec = obfd->xvec;
nbfd->my_archive = obfd;
nbfd->direction = read_direction;
@ -84,7 +84,7 @@ new_bfd_contained_in (obfd)
/*
SECTION
Opening and Closing BFDs
Opening and closing BFDs
*/
@ -99,22 +99,22 @@ DESCRIPTION
Open the file @var{filename} (using <<fopen>>) with the target
@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
that function.
If <<NULL>> is returned then an error has occured. Possible errors
are <<no_memory>>, <<invalid_target>> or <<system_call>> error.
*/
bfd *
DEFUN(bfd_openr, (filename, target),
CONST char *filename AND
CONST char *target)
bfd_openr (filename, target)
CONST char *filename;
CONST char *target;
{
bfd *nbfd;
bfd_target *target_vec;
nbfd = new_bfd();
nbfd = _bfd_new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
return NULL;
@ -173,10 +173,10 @@ DESCRIPTION
*/
bfd *
DEFUN(bfd_fdopenr,(filename, target, fd),
CONST char *filename AND
CONST char *target AND
int fd)
bfd_fdopenr (filename, target, fd)
CONST char *filename;
CONST char *target;
int fd;
{
bfd *nbfd;
bfd_target *target_vec;
@ -191,7 +191,7 @@ DEFUN(bfd_fdopenr,(filename, target, fd),
#endif
if (fdflags == -1) return NULL;
nbfd = new_bfd();
nbfd = _bfd_new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
@ -260,9 +260,9 @@ DESCRIPTION
*/
bfd *
DEFUN(bfd_openw,(filename, target),
CONST char *filename AND
CONST char *target)
bfd_openw (filename, target)
CONST char *filename;
CONST char *target;
{
bfd *nbfd;
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
reclaim it correctly. */
nbfd = new_bfd();
nbfd = _bfd_new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
return NULL;
@ -318,8 +318,8 @@ RETURNS
boolean
DEFUN(bfd_close,(abfd),
bfd *abfd)
bfd_close (abfd)
bfd *abfd;
{
boolean ret;
@ -379,8 +379,8 @@ RETURNS
*/
boolean
DEFUN(bfd_close_all_done,(abfd),
bfd *abfd)
bfd_close_all_done (abfd)
bfd *abfd;
{
boolean ret;
@ -424,8 +424,8 @@ DESCRIPTION
*/
bfd_size_type
DEFUN(bfd_alloc_size,(abfd),
bfd *abfd)
bfd_alloc_size (abfd)
bfd *abfd;
{
struct _obstack_chunk *chunk = abfd->memory.chunk;
size_t size = 0;
@ -454,11 +454,11 @@ DESCRIPTION
*/
bfd *
DEFUN(bfd_create,(filename, templ),
CONST char *filename AND
bfd *templ)
bfd_create (filename, templ)
CONST char *filename;
bfd *templ;
{
bfd *nbfd = new_bfd();
bfd *nbfd = _bfd_new_bfd();
if (nbfd == (bfd *)NULL) {
bfd_error = no_memory;
return (bfd *)NULL;
@ -486,37 +486,42 @@ DESCRIPTION
PTR
DEFUN(bfd_alloc_by_size_t,(abfd, size),
bfd *abfd AND
size_t size)
bfd_alloc_by_size_t (abfd, size)
bfd *abfd;
size_t size;
{
PTR res = obstack_alloc(&(abfd->memory), size);
return res;
}
DEFUN(void bfd_alloc_grow,(abfd, ptr, size),
bfd *abfd AND
PTR ptr AND
size_t size)
void
bfd_alloc_grow (abfd, ptr, size)
bfd *abfd;
PTR ptr;
size_t 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));
}
DEFUN(PTR bfd_alloc, (abfd, size),
bfd *abfd AND
size_t size)
PTR
bfd_alloc (abfd, size)
bfd *abfd;
size_t size;
{
return bfd_alloc_by_size_t(abfd, (size_t)size);
}
DEFUN(PTR bfd_zalloc,(abfd, size),
bfd *abfd AND
size_t size)
PTR
bfd_zalloc (abfd, size)
bfd *abfd;
size_t size;
{
PTR res;
res = bfd_alloc(abfd, size);
@ -524,10 +529,11 @@ DEFUN(PTR bfd_zalloc,(abfd, size),
return res;
}
DEFUN(PTR bfd_realloc,(abfd, old, size),
bfd *abfd AND
PTR old AND
size_t size)
PTR
bfd_realloc (abfd, old, size)
bfd *abfd;
PTR old;
size_t size;
{
PTR res = bfd_alloc(abfd, size);
memcpy(res, old, (size_t)size);