forked from Imagelibrary/binutils-gdb
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* 8 and 16 bit COFF relocation functions, for BFD.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@@ -137,17 +137,16 @@ bfd_perform_slip (abfd, slip, input_section, value)
|
||||
}
|
||||
|
||||
boolean
|
||||
bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
|
||||
bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
|
||||
bfd *abfd;
|
||||
asection *i;
|
||||
asection *input_section;
|
||||
struct bfd_link_info *link_info;
|
||||
boolean *again;
|
||||
{
|
||||
/* Get enough memory to hold the stuff. */
|
||||
bfd *input_bfd = i->owner;
|
||||
asection *input_section = i;
|
||||
int *shrinks;
|
||||
int shrink = 0;
|
||||
bfd *input_bfd = input_section->owner;
|
||||
unsigned *shrinks;
|
||||
unsigned shrink = 0;
|
||||
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
|
||||
arelent **reloc_vector = NULL;
|
||||
long reloc_count;
|
||||
@@ -159,7 +158,7 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
|
||||
if (reloc_size < 0)
|
||||
return false;
|
||||
|
||||
reloc_vector = (arelent **) bfd_malloc (reloc_size);
|
||||
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
|
||||
if (!reloc_vector && reloc_size > 0)
|
||||
return false;
|
||||
|
||||
@@ -191,11 +190,14 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
|
||||
if (reloc_count > 0)
|
||||
{
|
||||
int another_pass = 0;
|
||||
bfd_size_type amt;
|
||||
|
||||
/* Allocate and initialize the shrinks array for this section.
|
||||
The last element is used as an accumlator of shrinks. */
|
||||
shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int));
|
||||
memset (shrinks, 0, (reloc_count + 1) * sizeof (int));
|
||||
amt = reloc_count + 1;
|
||||
amt *= sizeof (unsigned);
|
||||
shrinks = (unsigned *) bfd_malloc (amt);
|
||||
memset (shrinks, 0, (size_t) amt);
|
||||
|
||||
/* Loop until nothing changes in this section. */
|
||||
do {
|
||||
@@ -268,11 +270,11 @@ bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
|
||||
if (!bfd_get_section_contents(input_bfd,
|
||||
input_section,
|
||||
data,
|
||||
0,
|
||||
(bfd_vma) 0,
|
||||
input_section->_raw_size))
|
||||
return NULL;
|
||||
|
||||
reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size);
|
||||
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
|
||||
if (!reloc_vector && reloc_size != 0)
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user