/* BFD back-end for Intel 960 b.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
#include "aout/stab_gnu.h"
#include "libaout.h" /* BFD a.out internal data structures. */
-static int aligncode PARAMS ((bfd *abfd, asection *input_section, arelent *r, unsigned int shrink));
-static void perform_slip PARAMS ((bfd *abfd, unsigned int slip, asection *input_section, bfd_vma value));
-static boolean b_out_squirt_out_relocs PARAMS ((bfd *abfd, asection *section));
-static const bfd_target * b_out_callback PARAMS ((bfd *));
-static bfd_reloc_status_type calljx_callback PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst, asection *));
-static bfd_reloc_status_type callj_callback PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data, unsigned int srcidx, unsigned int dstidx, asection *, boolean));
-static bfd_vma get_value PARAMS ((arelent *, struct bfd_link_info *, asection *));
-static int abs32code PARAMS ((bfd *, asection *, arelent *, unsigned int, struct bfd_link_info *));
-static boolean b_out_bfd_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
-static bfd_byte * b_out_bfd_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, boolean, asymbol **));
-static int b_out_sizeof_headers PARAMS ((bfd *, boolean));
-static boolean b_out_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static boolean b_out_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static long b_out_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-static long b_out_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-static boolean b_out_slurp_reloc_table PARAMS ((bfd *, sec_ptr, asymbol **));
-static reloc_howto_type * b_out_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-static boolean b_out_write_object_contents PARAMS ((bfd *));
-static int b_out_symbol_cmp PARAMS ((const void *, const void *));
-static boolean b_out_mkobject PARAMS ((bfd *));
-static const bfd_target * b_out_object_p PARAMS ((bfd *));
-
-void bout_swap_exec_header_in PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-void bout_swap_exec_header_out PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
+static int aligncode
+ PARAMS ((bfd *abfd, asection *input_section, arelent *r,
+ unsigned int shrink));
+static void perform_slip
+ PARAMS ((bfd *abfd, unsigned int slip, asection *input_section,
+ bfd_vma value));
+static bfd_boolean b_out_squirt_out_relocs
+ PARAMS ((bfd *abfd, asection *section));
+static const bfd_target *b_out_callback
+ PARAMS ((bfd *));
+static bfd_reloc_status_type calljx_callback
+ PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst,
+ asection *));
+static bfd_reloc_status_type callj_callback
+ PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data,
+ unsigned int srcidx, unsigned int dstidx, asection *, bfd_boolean));
+static bfd_vma get_value
+ PARAMS ((arelent *, struct bfd_link_info *, asection *));
+static int abs32code
+ PARAMS ((bfd *, asection *, arelent *, unsigned int,
+ struct bfd_link_info *));
+static bfd_boolean b_out_bfd_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+static bfd_byte *b_out_bfd_get_relocated_section_contents
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bfd_boolean, asymbol **));
+static int b_out_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean b_out_set_arch_mach
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+static bfd_boolean b_out_set_section_contents
+ PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
+static long b_out_get_reloc_upper_bound
+ PARAMS ((bfd *, sec_ptr));
+static long b_out_canonicalize_reloc
+ PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+static bfd_boolean b_out_slurp_reloc_table
+ PARAMS ((bfd *, sec_ptr, asymbol **));
+static reloc_howto_type *b_out_bfd_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static bfd_boolean b_out_write_object_contents
+ PARAMS ((bfd *));
+static int b_out_symbol_cmp
+ PARAMS ((const void *, const void *));
+static bfd_boolean b_out_mkobject
+ PARAMS ((bfd *));
+static const bfd_target *b_out_object_p
+ PARAMS ((bfd *));
+
+void bout_swap_exec_header_in
+ PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
+void bout_swap_exec_header_out
+ PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
/* Swaps the information in an executable header taken from a raw byte
stream memory image, into the internal exec_header structure. */
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the execp, from the bytes in the raw data. */
- execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
+ execp->a_info = H_GET_32 (abfd, bytes->e_info);
execp->a_text = GET_WORD (abfd, bytes->e_text);
execp->a_data = GET_WORD (abfd, bytes->e_data);
execp->a_bss = GET_WORD (abfd, bytes->e_bss);
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
- bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
+ H_PUT_32 (abfd, execp->a_info , bytes->e_info);
PUT_WORD (abfd, execp->a_text , bytes->e_text);
PUT_WORD (abfd, execp->a_data , bytes->e_data);
PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
{
struct internal_exec anexec;
struct external_exec exec_bytes;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
- if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE)
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
- anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+ anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
if (N_BADMAG (anexec))
{
struct internal_exec e;
};
-static boolean
+static bfd_boolean
b_out_mkobject (abfd)
bfd *abfd;
{
struct bout_data_struct *rawptr;
+ bfd_size_type amt = sizeof (struct bout_data_struct);
- rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
+ rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
- return false;
+ return FALSE;
abfd->tdata.bout_data = rawptr;
exec_hdr (abfd) = &rawptr->e;
- obj_textsec (abfd) = (asection *)NULL;
- obj_datasec (abfd) = (asection *)NULL;
- obj_bsssec (abfd) = (asection *)NULL;
+ obj_textsec (abfd) = (asection *) NULL;
+ obj_datasec (abfd) = (asection *) NULL;
+ obj_bsssec (abfd) = (asection *) NULL;
- return true;
+ return TRUE;
}
static int
return 0;
}
-static boolean
+static bfd_boolean
b_out_write_object_contents (abfd)
bfd *abfd;
{
struct external_exec swapped_hdr;
+ bfd_size_type amt;
if (! aout_32_make_sections (abfd))
- return false;
+ return FALSE;
exec_hdr (abfd)->a_info = BMAGIC;
bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
+ amt = EXEC_BYTES_SIZE;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE))
- return false;
+ || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
+ return FALSE;
/* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0)
}
if (q > outsyms)
- qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp);
+ qsort (outsyms, (size_t) (q - outsyms), sizeof (asymbol*),
+ b_out_symbol_cmp);
/* Back to your regularly scheduled program. */
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
!= 0)
- return false;
+ return FALSE;
if (! aout_32_write_syms (abfd))
- return false;
+ return FALSE;
- if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
- return false;
+ if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return FALSE;
- if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
+ if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd)))
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
!= 0)
- return false;
+ return FALSE;
- if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd))) return false;
+ if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd)))
+ return FALSE;
}
- return true;
+ return TRUE;
}
\f
/* Some reloc hackery. */
BFD_ASSERT (IS_BALNAME (balsym->other));
inst &= BALX_MASK;
inst |= BALX;
- bfd_put_32 (abfd, inst, (bfd_byte *) dst-4);
+ bfd_put_32 (abfd, (bfd_vma) inst, (bfd_byte *) dst-4);
symbol = balsym;
value = (symbol->symbol.value
+ output_addr (symbol->symbol.section));
word += value + reloc_entry->addend;
- bfd_put_32 (abfd, word, dst);
+ bfd_put_32 (abfd, (bfd_vma) word, dst);
return bfd_reloc_ok;
}
unsigned int srcidx;
unsigned int dstidx;
asection *input_section;
- boolean shrinking;
+ bfd_boolean shrinking;
{
int word = bfd_get_32 (abfd, (bfd_byte *) data + srcidx);
asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
- output_addr (input_section))
& BAL_MASK);
}
- bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx);
+ bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx);
return bfd_reloc_ok;
}
#define ALIGNER 10
#define ALIGNDONE 11
static reloc_howto_type howto_reloc_callj =
-HOWTO(CALLJ, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callj", true, 0x00ffffff, 0x00ffffff,false);
+HOWTO(CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
static reloc_howto_type howto_reloc_abs32 =
-HOWTO(ABS32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"abs32", true, 0xffffffff,0xffffffff,false);
+HOWTO(ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE);
static reloc_howto_type howto_reloc_pcrel24 =
-HOWTO(PCREL24, 0, 2, 24, true, 0, complain_overflow_signed,0,"pcrel24", true, 0x00ffffff,0x00ffffff,false);
+HOWTO(PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE);
static reloc_howto_type howto_reloc_pcrel13 =
-HOWTO(PCREL13, 0, 2, 13, true, 0, complain_overflow_signed,0,"pcrel13", true, 0x00001fff,0x00001fff,false);
+HOWTO(PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE);
static reloc_howto_type howto_reloc_abs32codeshrunk =
-HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callx->callj", true, 0x00ffffff, 0x00ffffff,false);
+HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
static reloc_howto_type howto_reloc_abs32code =
-HOWTO(ABS32CODE, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"callx", true, 0xffffffff,0xffffffff,false);
+HOWTO(ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE);
static reloc_howto_type howto_align_table[] = {
- HOWTO (ALIGNER, 0, 0x1, 0, false, 0, complain_overflow_dont, 0, "align16", false, 0, 0, false),
- HOWTO (ALIGNER, 0, 0x3, 0, false, 0, complain_overflow_dont, 0, "align32", false, 0, 0, false),
- HOWTO (ALIGNER, 0, 0x7, 0, false, 0, complain_overflow_dont, 0, "align64", false, 0, 0, false),
- HOWTO (ALIGNER, 0, 0xf, 0, false, 0, complain_overflow_dont, 0, "align128", false, 0, 0, false),
+ HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE),
};
static reloc_howto_type howto_done_align_table[] = {
- HOWTO (ALIGNDONE, 0x1, 0x1, 0, false, 0, complain_overflow_dont, 0, "donealign16", false, 0, 0, false),
- HOWTO (ALIGNDONE, 0x3, 0x3, 0, false, 0, complain_overflow_dont, 0, "donealign32", false, 0, 0, false),
- HOWTO (ALIGNDONE, 0x7, 0x7, 0, false, 0, complain_overflow_dont, 0, "donealign64", false, 0, 0, false),
- HOWTO (ALIGNDONE, 0xf, 0xf, 0, false, 0, complain_overflow_dont, 0, "donealign128", false, 0, 0, false),
+ HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE),
};
static reloc_howto_type *
/* Allocate enough room for all the reloc entries, plus pointers to them all. */
-static boolean
+static bfd_boolean
b_out_slurp_reloc_table (abfd, asect, symbols)
bfd *abfd;
sec_ptr asect;
asymbol **symbols;
{
register struct relocation_info *rptr;
- unsigned int counter ;
- arelent *cache_ptr ;
+ unsigned int counter;
+ arelent *cache_ptr;
int extern_mask, pcrel_mask, callj_mask, length_shift;
int incode_mask;
int size_mask;
bfd_vma prev_addr = 0;
unsigned int count;
- size_t reloc_size;
+ bfd_size_type reloc_size, amt;
struct relocation_info *relocs;
arelent *reloc_cache;
if (asect->relocation)
- return true;
+ return TRUE;
if (!aout_32_slurp_symbol_table (abfd))
- return false;
+ return FALSE;
if (asect == obj_datasec (abfd))
{
}
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
doit:
- if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos), SEEK_SET) != 0)
- return false;
+ if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
+ return FALSE;
count = reloc_size / sizeof (struct relocation_info);
relocs = (struct relocation_info *) bfd_malloc (reloc_size);
if (!relocs && reloc_size != 0)
- return false;
+ return FALSE;
- reloc_cache = (arelent *) bfd_malloc ((count+1) * sizeof (arelent));
+ amt = ((bfd_size_type) count + 1) * sizeof (arelent);
+ reloc_cache = (arelent *) bfd_malloc (amt);
if (!reloc_cache)
{
if (relocs != NULL)
- free ((char*)relocs);
- return false;
+ free (relocs);
+ return FALSE;
}
- if (bfd_read ((PTR) relocs, 1, reloc_size, abfd) != reloc_size)
+ if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size)
{
free (reloc_cache);
if (relocs != NULL)
free (relocs);
- return false;
+ return FALSE;
}
if (bfd_header_big_endian (abfd))
unsigned char *raw = (unsigned char *)rptr;
unsigned int symnum;
- cache_ptr->address = bfd_h_get_32 (abfd, raw + 0);
+ cache_ptr->address = H_GET_32 (abfd, raw + 0);
cache_ptr->howto = 0;
if (bfd_header_big_endian (abfd))
if (raw[7] & extern_mask)
{
- /* If this is set then the r_index is a index into the symbol table;
+ /* If this is set then the r_index is an index into the symbol table;
if the bit is not set then r_index contains a section map.
We either fill in the sym entry with a pointer to the symbol,
or point to the correct section. */
asect->relocation = reloc_cache;
asect->reloc_count = count;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
b_out_squirt_out_relocs (abfd, section)
bfd *abfd;
asection *section;
int len_1;
unsigned int count = section->reloc_count;
struct relocation_info *native, *natptr;
- size_t natsize = count * sizeof (struct relocation_info);
- int extern_mask, pcrel_mask, len_2, callj_mask;
+ bfd_size_type natsize;
+ int extern_mask, pcrel_mask, len_2, callj_mask;
if (count == 0)
- return true;
+ return TRUE;
- generic = section->orelocation;
+ generic = section->orelocation;
+ natsize = (bfd_size_type) count * sizeof (struct relocation_info);
native = ((struct relocation_info *) bfd_malloc (natsize));
if (!native && natsize != 0)
- return false;
+ return FALSE;
if (bfd_header_big_endian (abfd))
{
asymbol *sym = *(g->sym_ptr_ptr);
asection *output_section = sym->section->output_section;
- bfd_h_put_32(abfd, g->address, raw);
+ H_PUT_32 (abfd, g->address, raw);
/* Find a type in the output format which matches the input howto -
at the moment we assume input format == output format FIXME!! */
r_idx = 0;
raw[7] |= extern_mask;
}
- if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize)
+ if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
{
free ((PTR)native);
- return false;
+ return FALSE;
}
free ((PTR)native);
- return true;
+ return TRUE;
}
/* This is stupid. This function should be a boolean predicate. */
}
\f
-static boolean
+static bfd_boolean
b_out_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
file_ptr offset;
bfd_size_type count;
{
- if (abfd->output_has_begun == false)
+ if (! abfd->output_has_begun)
{
/* Set by bfd.c handler. */
if (! aout_32_make_sections (abfd))
- return false;
+ return FALSE;
obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
/* Regardless, once we know what we're doing, we might as well get going. */
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
- return false;
+ return FALSE;
- if (count != 0)
- return (bfd_write ((PTR)location, 1, count, abfd) == count) ? true : false;
+ if (count == 0)
+ return TRUE;
- return true;
+ return bfd_bwrite ((PTR) location, count, abfd) == count;
}
-static boolean
+static bfd_boolean
b_out_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
bfd_default_set_arch_mach(abfd, arch, machine);
if (arch == bfd_arch_unknown) /* Unknown machine arch is OK. */
- return true;
+ return TRUE;
if (arch == bfd_arch_i960) /* i960 default is OK. */
switch (machine)
case bfd_mach_i960_jx:
case bfd_mach_i960_hx:
case 0:
- return true;
+ return TRUE;
default:
- return false;
+ return FALSE;
}
- return false;
+ return FALSE;
}
static int
b_out_sizeof_headers (ignore_abfd, ignore)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
- boolean ignore ATTRIBUTE_UNUSED;
+ bfd_boolean ignore ATTRIBUTE_UNUSED;
{
return sizeof (struct internal_exec);
}
generic symbols. */
h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
bfd_asymbol_name (symbol),
- false, false, true);
+ FALSE, FALSE, TRUE);
if (h != (struct bfd_link_hash_entry *) NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak))
if (! ((*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (symbol),
input_section->owner, input_section, reloc->address,
- true)))
+ TRUE)))
abort ();
value = 0;
}
bfd_vma gap;
bfd_vma old_end;
bfd_vma new_end;
- int shrink_delta;
+ unsigned int shrink_delta;
int size = r->howto->size;
/* Reduce the size of the alignment so that it's still aligned but
return shrink;
}
-static boolean
+static bfd_boolean
b_out_bfd_relax_section (abfd, i, link_info, again)
bfd *abfd;
asection *i;
struct bfd_link_info *link_info;
- boolean *again;
+ bfd_boolean *again;
{
/* Get enough memory to hold the stuff. */
bfd *input_bfd = i->owner;
asection *input_section = i;
- int shrink = 0 ;
+ unsigned int shrink = 0 ;
arelent **reloc_vector = NULL;
- long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
- input_section);
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
+ input_section);
if (reloc_size < 0)
- return false;
+ return FALSE;
/* We only run this relaxation once. It might work to run it
multiple times, but it hasn't been tested. */
- *again = false;
+ *again = FALSE;
if (reloc_size)
{
long reloc_count;
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
link_info);
break;
case ABS32CODE_SHRUNK:
- shrink+=4;
+ shrink += 4;
break;
}
}
if (reloc_vector != NULL)
free (reloc_vector);
- return true;
+ return TRUE;
error_return:
if (reloc_vector != NULL)
free (reloc_vector);
- return false;
+ return FALSE;
}
static bfd_byte *
b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
- data, relocateable, symbols)
+ data, relocatable, symbols)
bfd *output_bfd;
struct bfd_link_info *link_info;
struct bfd_link_order *link_order;
bfd_byte *data;
- boolean relocateable;
+ bfd_boolean relocatable;
asymbol **symbols;
{
/* Get enough memory to hold the stuff. */
if (reloc_size < 0)
goto error_return;
- /* If producing relocateable output, don't bother to relax. */
- if (relocateable)
+ /* If producing relocatable output, don't bother to relax. */
+ if (relocatable)
return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
link_order,
- data, relocateable,
+ data, relocatable,
symbols);
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
input_section->reloc_done = 1;
/* Read in the section. */
- BFD_ASSERT (true == bfd_get_section_contents (input_bfd,
- input_section,
- data,
- 0,
- input_section->_raw_size));
+ BFD_ASSERT (bfd_get_section_contents (input_bfd,
+ input_section,
+ data,
+ (bfd_vma) 0,
+ input_section->_raw_size));
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
case CALLJ:
callj_callback (input_bfd, link_info, reloc, data,
src_address, dst_address, input_section,
- false);
+ FALSE);
src_address += 4;
dst_address += 4;
break;
case ALIGNDONE:
BFD_ASSERT (reloc->addend >= src_address);
- BFD_ASSERT (reloc->addend <= input_section->_raw_size);
+ BFD_ASSERT ((bfd_vma) reloc->addend
+ <= input_section->_raw_size);
src_address = reloc->addend;
dst_address = ((dst_address + reloc->howto->size)
& ~reloc->howto->size);
callj will reach, so do the right thing. */
callj_callback (input_bfd, link_info, reloc, data,
src_address + 4, dst_address, input_section,
- true);
+ TRUE);
dst_address += 4;
src_address += 8;
break;
+ reloc->addend)
& BAL_MASK));
- bfd_put_32 (input_bfd, word, data + dst_address);
+ bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
dst_address += 4;
src_address += 4;
- output_addr (input_section))
& PCREL13_MASK));
- bfd_put_32 (input_bfd, word, data + dst_address);
+ bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
dst_address += 4;
src_address += 4;
}
#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
#define b_out_bfd_final_link _bfd_generic_final_link
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
#define b_out_bfd_gc_sections bfd_generic_gc_sections
#define b_out_bfd_merge_sections bfd_generic_merge_sections
+#define b_out_bfd_discard_group bfd_generic_discard_group
#define aout_32_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window