* opncls.c (bfd_alloc): Rename from bfd_alloc_by_size_t. Remove
old version of bfd_alloc. * libbfd-in.h (bfd_alloc_by_size_t): Don't declare. * libbfd.h: Rebuild. * Several files: Call bfd_alloc rather than bfd_alloc_by_size_t.
This commit is contained in:
parent
590c50d82c
commit
50ede03d76
|
@ -1,3 +1,11 @@
|
|||
Mon Mar 17 11:32:53 1997 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* opncls.c (bfd_alloc): Rename from bfd_alloc_by_size_t. Remove
|
||||
old version of bfd_alloc.
|
||||
* libbfd-in.h (bfd_alloc_by_size_t): Don't declare.
|
||||
* libbfd.h: Rebuild.
|
||||
* Several files: Call bfd_alloc rather than bfd_alloc_by_size_t.
|
||||
|
||||
Sat Mar 15 15:24:18 1997 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* elf32-mips.c (mips_elf_is_local_label_name): Accept the generic
|
||||
|
|
|
@ -796,7 +796,7 @@ dependent COFF routines:
|
|||
. boolean (*_bfd_coff_sym_is_global) PARAMS ((
|
||||
. bfd *abfd,
|
||||
. struct internal_syment *));
|
||||
. void (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
. boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
. bfd *abfd));
|
||||
. boolean (*_bfd_coff_start_final_link) PARAMS ((
|
||||
. bfd *output_bfd,
|
||||
|
@ -2069,13 +2069,14 @@ coff_set_arch_mach (abfd, arch, machine)
|
|||
|
||||
/* Calculate the file position for each section. */
|
||||
|
||||
static void
|
||||
static boolean
|
||||
coff_compute_section_file_positions (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
asection *current;
|
||||
asection *previous = (asection *) NULL;
|
||||
file_ptr sofar = FILHSZ;
|
||||
boolean align_adjust;
|
||||
|
||||
#ifndef I960
|
||||
file_ptr old_sofar;
|
||||
|
@ -2161,6 +2162,7 @@ coff_compute_section_file_positions (abfd)
|
|||
sofar += SCNHSZ;
|
||||
#endif
|
||||
|
||||
align_adjust = false;
|
||||
for (current = abfd->sections, count = 1;
|
||||
current != (asection *) NULL;
|
||||
current = current->next, ++count)
|
||||
|
@ -2209,20 +2211,14 @@ coff_compute_section_file_positions (abfd)
|
|||
current->used_by_bfd =
|
||||
(PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
|
||||
if (current->used_by_bfd == NULL)
|
||||
{
|
||||
/* FIXME: Return error. */
|
||||
abort ();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (pei_section_data (abfd, current) == NULL)
|
||||
{
|
||||
coff_section_data (abfd, current)->tdata =
|
||||
(PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
|
||||
if (coff_section_data (abfd, current)->tdata == NULL)
|
||||
{
|
||||
/* FIXME: Return error. */
|
||||
abort ();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (pei_section_data (abfd, current)->virt_size == 0)
|
||||
pei_section_data (abfd, current)->virt_size = current->_raw_size;
|
||||
|
@ -2241,12 +2237,14 @@ coff_compute_section_file_positions (abfd)
|
|||
old_size = current->_raw_size;
|
||||
current->_raw_size = BFD_ALIGN (current->_raw_size,
|
||||
1 << current->alignment_power);
|
||||
align_adjust = current->_raw_size != old_size;
|
||||
sofar += current->_raw_size - old_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
old_sofar = sofar;
|
||||
sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
|
||||
align_adjust = sofar != old_sofar;
|
||||
current->_raw_size += sofar - old_sofar;
|
||||
}
|
||||
#endif
|
||||
|
@ -2262,12 +2260,30 @@ coff_compute_section_file_positions (abfd)
|
|||
previous = current;
|
||||
}
|
||||
|
||||
/* Make sure the relocations are aligned. */
|
||||
/* It is now safe to write to the output file. If we needed an
|
||||
alignment adjustment for the last section, then make sure that
|
||||
there is a byte at offset sofar. If there are no symbols and no
|
||||
relocs, then nothing follows the last section. If we don't force
|
||||
the last byte out, then the file may appear to be truncated. */
|
||||
if (align_adjust)
|
||||
{
|
||||
bfd_byte b;
|
||||
|
||||
b = 0;
|
||||
if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
|
||||
|| bfd_write (&b, 1, 1, abfd) != 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Make sure the relocations are aligned. We don't need to make
|
||||
sure that this byte exists, because it will only matter if there
|
||||
really are relocs. */
|
||||
sofar = BFD_ALIGN (sofar, 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER);
|
||||
|
||||
obj_relocbase (abfd) = sofar;
|
||||
abfd->output_has_begun = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -2324,7 +2340,7 @@ coff_add_missing_symbols (abfd)
|
|||
if (!need_text && !need_data && !need_bss && !need_file)
|
||||
return true;
|
||||
nsyms += need_text + need_data + need_bss + need_file;
|
||||
sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *));
|
||||
sympp2 = (asymbol **) bfd_alloc (abfd, nsyms * sizeof (asymbol *));
|
||||
if (!sympp2)
|
||||
return false;
|
||||
memcpy (sympp2, sympp, i * sizeof (asymbol *));
|
||||
|
@ -2379,7 +2395,10 @@ coff_write_object_contents (abfd)
|
|||
lnno_size = coff_count_linenumbers (abfd) * LINESZ;
|
||||
|
||||
if (abfd->output_has_begun == false)
|
||||
coff_compute_section_file_positions (abfd);
|
||||
{
|
||||
if (! coff_compute_section_file_positions (abfd))
|
||||
return false;
|
||||
}
|
||||
|
||||
reloc_base = obj_relocbase (abfd);
|
||||
|
||||
|
@ -3015,7 +3034,10 @@ coff_set_section_contents (abfd, section, location, offset, count)
|
|||
bfd_size_type count;
|
||||
{
|
||||
if (abfd->output_has_begun == false) /* set by bfd.c handler */
|
||||
coff_compute_section_file_positions (abfd);
|
||||
{
|
||||
if (! coff_compute_section_file_positions (abfd))
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_LIB) && !defined(TARG_AUX)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* BFD back-end for HP PA-RISC ELF files.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Written by
|
||||
|
||||
|
@ -234,7 +235,7 @@ static void add_entry_to_symext_chain
|
|||
static void
|
||||
elf_hppa_tc_make_sections PARAMS ((bfd *, symext_chainS *));
|
||||
|
||||
static boolean hppa_elf_is_local_label PARAMS ((bfd *, asymbol *));
|
||||
static boolean hppa_elf_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
|
||||
static boolean elf32_hppa_add_symbol_hook
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
||||
|
@ -953,14 +954,14 @@ hppa_elf_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
|
|||
elf32_hppa_reloc_type **final_types;
|
||||
|
||||
/* Allocate slots for the BFD relocation. */
|
||||
final_types = (elf32_hppa_reloc_type **)
|
||||
bfd_alloc_by_size_t (abfd, sizeof (elf32_hppa_reloc_type *) * 2);
|
||||
final_types = ((elf32_hppa_reloc_type **)
|
||||
bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type *) * 2));
|
||||
if (final_types == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Allocate space for the relocation itself. */
|
||||
finaltype = (elf32_hppa_reloc_type *)
|
||||
bfd_alloc_by_size_t (abfd, sizeof (elf32_hppa_reloc_type));
|
||||
finaltype = ((elf32_hppa_reloc_type *)
|
||||
bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type)));
|
||||
if (finaltype == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1553,11 +1554,11 @@ elf_hppa_reloc_type_lookup (abfd, code)
|
|||
/* Return true if SYM represents a local label symbol. */
|
||||
|
||||
static boolean
|
||||
hppa_elf_is_local_label (abfd, sym)
|
||||
hppa_elf_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
asymbol *sym;
|
||||
const char *name;
|
||||
{
|
||||
return (sym->name[0] == 'L' && sym->name[1] == '$');
|
||||
return (name[0] == 'L' && name[1] == '$');
|
||||
}
|
||||
|
||||
/* Do any backend specific processing when beginning to write an object
|
||||
|
@ -2959,7 +2960,7 @@ error_return:
|
|||
|
||||
/* Misc BFD support code. */
|
||||
#define bfd_elf32_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup
|
||||
#define bfd_elf32_bfd_is_local_label hppa_elf_is_local_label
|
||||
#define bfd_elf32_bfd_is_local_label_name hppa_elf_is_local_label_name
|
||||
|
||||
/* Symbol extension stuff. */
|
||||
#define bfd_elf32_set_section_contents elf32_hppa_set_section_contents
|
||||
|
|
|
@ -93,7 +93,6 @@ PTR bfd_alloc PARAMS ((bfd *abfd, size_t size));
|
|||
PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size));
|
||||
void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size));
|
||||
PTR bfd_alloc_finish PARAMS ((bfd *abfd));
|
||||
PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted));
|
||||
|
||||
#define bfd_release(x,y) (void) obstack_free(&(x->memory),y)
|
||||
|
||||
|
@ -486,7 +485,7 @@ extern bfd *bfd_last_cache;
|
|||
/* List of supported target vectors, and the default vector (if
|
||||
bfd_default_vector[0] is NULL, there is no default). */
|
||||
extern const bfd_target * const bfd_target_vector[];
|
||||
extern const bfd_target * const bfd_default_vector[];
|
||||
extern const bfd_target *bfd_default_vector[];
|
||||
|
||||
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
|
||||
other common header files. */
|
||||
|
|
|
@ -93,7 +93,6 @@ PTR bfd_alloc PARAMS ((bfd *abfd, size_t size));
|
|||
PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size));
|
||||
void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size));
|
||||
PTR bfd_alloc_finish PARAMS ((bfd *abfd));
|
||||
PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted));
|
||||
|
||||
#define bfd_release(x,y) (void) obstack_free(&(x->memory),y)
|
||||
|
||||
|
@ -486,7 +485,7 @@ extern bfd *bfd_last_cache;
|
|||
/* List of supported target vectors, and the default vector (if
|
||||
bfd_default_vector[0] is NULL, there is no default). */
|
||||
extern const bfd_target * const bfd_target_vector[];
|
||||
extern const bfd_target * const bfd_default_vector[];
|
||||
extern const bfd_target *bfd_default_vector[];
|
||||
|
||||
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
|
||||
other common header files. */
|
||||
|
|
22
bfd/opncls.c
22
bfd/opncls.c
|
@ -1,5 +1,7 @@
|
|||
/* opncls.c -- open and close a BFD.
|
||||
Copyright (C) 1990 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
@ -226,7 +228,7 @@ bfd_fdopenr (filename, target, fd)
|
|||
bfd_set_error (bfd_error_invalid_target);
|
||||
return NULL;
|
||||
}
|
||||
#if defined(VMS) || defined(__GO32__) || defined (WINGDB)
|
||||
#if defined(VMS) || defined(__GO32__)
|
||||
nbfd->iostream = (PTR)fopen(filename, FOPEN_RB);
|
||||
#else
|
||||
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
|
||||
|
@ -539,19 +541,19 @@ bfd_create (filename, templ)
|
|||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_alloc_by_size_t
|
||||
bfd_alloc
|
||||
|
||||
SYNOPSIS
|
||||
PTR bfd_alloc_by_size_t(bfd *abfd, size_t wanted);
|
||||
PTR bfd_alloc (bfd *abfd, size_t wanted);
|
||||
|
||||
DESCRIPTION
|
||||
Allocate a block of @var{wanted} bytes of memory in the obstack
|
||||
attatched to <<abfd>> and return a pointer to it.
|
||||
attached to <<abfd>> and return a pointer to it.
|
||||
*/
|
||||
|
||||
|
||||
PTR
|
||||
bfd_alloc_by_size_t (abfd, size)
|
||||
bfd_alloc (abfd, size)
|
||||
bfd *abfd;
|
||||
size_t size;
|
||||
{
|
||||
|
@ -584,14 +586,6 @@ bfd_alloc_finish (abfd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
PTR
|
||||
bfd_alloc (abfd, size)
|
||||
bfd *abfd;
|
||||
size_t size;
|
||||
{
|
||||
return bfd_alloc_by_size_t(abfd, (size_t)size);
|
||||
}
|
||||
|
||||
PTR
|
||||
bfd_zalloc (abfd, size)
|
||||
bfd *abfd;
|
||||
|
|
Loading…
Reference in New Issue