From 14e3c2e47d94bc9eee44e8a5b7f8458a4dbae36d Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Sat, 17 Apr 1993 00:39:36 +0000 Subject: [PATCH] * libbfd.c: Add signed versions of bfd_{h_,}{get,put}_signed_. libbfd.c, libbfd-in.h: Add _do*signed*. targets.c, all targets: Add bfd*signed*. bfd-in.h: Add bfd_signed_vma. Add comments. --- bfd/ChangeLog | 5 ++ bfd/bfd-in.h | 29 +++++-- bfd/coff-a29k.c | 10 ++- bfd/coff-mips.c | 37 +++++---- bfd/elf32-target.h | 16 +++- bfd/hppa.c | 8 +- bfd/libbfd-in.h | 186 +++++++++++++++++++++------------------------ bfd/libbfd.c | 131 ++++++++++++++++++++++++++++--- bfd/libbfd.h | 33 ++++---- bfd/targets.c | 32 +++++--- include/bfd.h | 92 +++++++++++++++------- 11 files changed, 386 insertions(+), 193 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5eb8fa493de..b7047420956 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ Thu Apr 15 09:09:18 1993 Jim Kingdon (kingdon@cygnus.com) + * libbfd.c: Add signed versions of bfd_{h_,}{get,put}_signed_. + libbfd.c, libbfd-in.h: Add _do*signed*. + targets.c, all targets: Add bfd*signed*. + bfd-in.h: Add bfd_signed_vma. Add comments. + * bfd-in.h (bfd_error), bfd.c (bfd_errmsgs): Add file_truncated. * format.c (bfd_check_error): Check error return from diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index a1e00dde966..3086167a699 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -68,20 +68,37 @@ typedef enum bfd_boolean {false, true} boolean; /* typedef off_t file_ptr; */ typedef long int file_ptr; -/* Support for different sizes of target format ints and addresses */ +/* Support for different sizes of target format ints and addresses. + If the host implements--and wants BFD to use--64-bit values, it + defines HOST_64_BIT (in BFD and in every program that calls it -- + since this affects declarations in bfd.h). */ #ifdef HOST_64_BIT -typedef HOST_64_BIT bfd_vma; -typedef HOST_64_BIT bfd_size_type; -typedef HOST_64_BIT symvalue; +typedef unsigned HOST_64_BIT bfd_vma; +typedef HOST_64_BIT bfd_signed_vma; +typedef unsigned HOST_64_BIT bfd_size_type; +typedef unsigned HOST_64_BIT symvalue; #define fprintf_vma(s,x) \ fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x)) -#else +#else /* not HOST_64_BIT. */ + +/* Represent a target address. Also used as a generic unsigned type + which is guaranteed to be big enough to hold any arithmetic types + we need to deal with. */ typedef unsigned long bfd_vma; + +/* A generic signed type which is guaranteed to be big enough to hold any + arithmetic types we need to deal with. Can be assumed to be compatible + with bfd_vma in the same way that signed and unsigned ints are compatible + (as parameters, in assignment, etc). */ +typedef long bfd_signed_vma; + typedef unsigned long symvalue; typedef unsigned long bfd_size_type; + +/* Print a bfd_vma x on stream s. */ #define fprintf_vma(s,x) fprintf(s, "%08lx", x) -#endif +#endif /* not HOST_64_BIT. */ #define printf_vma(x) fprintf_vma(stdout,x) typedef unsigned int flagword; /* 32 bits of flags */ diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index 5f6607eb773..e60fd40c547 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -307,11 +307,13 @@ bfd_target a29kcoff_big_vec = 15, /* ar_max_namelen */ 2, /* minimum section alignment */ /* data */ - _do_getb64, _do_putb64, _do_getb32, - _do_putb32, _do_getb16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, /* hdrs */ - _do_getb64, _do_putb64, _do_getb32, - _do_putb32, _do_getb16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, { diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 114803977b2..f9cc8f451cb 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -60,7 +60,7 @@ typedef struct ecoff_symbol_struct #define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd))) /* The page boundary used to align sections in the executable file. */ -#define PAGE_SIZE 0x2000 +#define ROUND_SIZE 0x1000 /* The linker needs a section to hold small common variables while linking. There is no convenient way to create it when the linker @@ -2174,8 +2174,11 @@ ecoff_find_nearest_line (abfd, pdr_ptr = ecoff_data (abfd)->external_pdr + fdr_ptr->ipdFirst; pdr_end = pdr_ptr + fdr_ptr->cpd; ecoff_swap_pdr_in (abfd, pdr_ptr, &pdr); - if (offset < pdr.adr) - return false; + + /* The address of the first PDR is an offset which applies to the + addresses of all the PDR's. */ + offset += pdr.adr; + for (pdr_ptr++; pdr_ptr < pdr_end; pdr_ptr++) { ecoff_swap_pdr_in (abfd, pdr_ptr, &pdr); @@ -3188,7 +3191,7 @@ ecoff_compute_section_file_positions (abfd) && first_data != false && (current->flags & SEC_CODE) == 0) { - sofar = (sofar + PAGE_SIZE - 1) &~ (PAGE_SIZE - 1); + sofar = (sofar + ROUND_SIZE - 1) &~ (ROUND_SIZE - 1); first_data = false; } @@ -3292,7 +3295,7 @@ ecoff_write_object_contents (abfd) be aligned to a page boundary. FIXME: Is this true on other platforms? */ if ((abfd->flags & EXEC_P) != 0) - sym_base = (sym_base + PAGE_SIZE - 1) &~ (PAGE_SIZE - 1); + sym_base = (sym_base + ROUND_SIZE - 1) &~ (ROUND_SIZE - 1); ecoff_data (abfd)->sym_filepos = sym_base; @@ -3440,10 +3443,10 @@ ecoff_write_object_contents (abfd) /* At least on Ultrix, these have to be rounded to page boundaries. FIXME: Is this true on other platforms? */ - internal_a.tsize = (text_size + PAGE_SIZE - 1) &~ (PAGE_SIZE - 1); - internal_a.text_start = text_start &~ (PAGE_SIZE - 1); - internal_a.dsize = (data_size + PAGE_SIZE - 1) &~ (PAGE_SIZE - 1); - internal_a.data_start = data_start &~ (PAGE_SIZE - 1); + internal_a.tsize = (text_size + ROUND_SIZE - 1) &~ (ROUND_SIZE - 1); + internal_a.text_start = text_start &~ (ROUND_SIZE - 1); + internal_a.dsize = (data_size + ROUND_SIZE - 1) &~ (ROUND_SIZE - 1); + internal_a.data_start = data_start &~ (ROUND_SIZE - 1); /* On Ultrix, the initial portions of the .sbss and .bss segments are at the end of the data section. The bsize field in the @@ -4123,8 +4126,12 @@ bfd_target ecoff_little_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen */ 3, /* minimum alignment power */ - _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */ - _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */ + _do_getl64, _do_getl_signed_64, _do_putl64, + _do_getl32, _do_getl_signed_32, _do_putl32, + _do_getl16, _do_getl_signed_16, _do_putl16, /* data */ + _do_getl64, _do_getl_signed_64, _do_putl64, + _do_getl32, _do_getl_signed_32, _do_putl32, + _do_getl16, _do_getl_signed_16, _do_putl16, /* hdrs */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ ecoff_archive_p, _bfd_dummy_target}, @@ -4152,8 +4159,12 @@ bfd_target ecoff_big_vec = ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ 3, /* minimum alignment power */ - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ ecoff_archive_p, _bfd_dummy_target}, {bfd_false, ecoff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ diff --git a/bfd/elf32-target.h b/bfd/elf32-target.h index 60d386cf212..50be6c202ef 100644 --- a/bfd/elf32-target.h +++ b/bfd/elf32-target.h @@ -98,10 +98,14 @@ bfd_target TARGET_BIG_SYM = 3, /* Routines to byte-swap various sized integers from the data sections */ - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, /* Routines to byte-swap various sized integers from the file headers */ - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, + _do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, /* bfd_check_format: check the format of a file being read */ { _bfd_dummy_target, /* unknown format */ @@ -176,10 +180,14 @@ bfd_target TARGET_LITTLE_SYM = 3, /* Routines to byte-swap various sized integers from the data sections */ - _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, + _do_getl64, _do_getl_signed_64, _do_putl64, + _do_getl32, _do_getl_signed_32, _do_putl32, + _do_getl16, _do_getl_signed_16, _do_putl16, /* Routines to byte-swap various sized integers from the file headers */ - _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, + _do_getl64, _do_getl_signed_64, _do_putl64, + _do_getl32, _do_getl_signed_32, _do_putl32, + _do_getl16, _do_getl_signed_16, _do_putl16, /* bfd_check_format: check the format of a file being read */ { _bfd_dummy_target, /* unknown format */ diff --git a/bfd/hppa.c b/bfd/hppa.c index 4a33c481382..cbab3161032 100644 --- a/bfd/hppa.c +++ b/bfd/hppa.c @@ -666,8 +666,12 @@ bfd_target hppa_vec = ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ 3, /* minimum alignment */ -_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 */ +_do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, /* data */ +_do_getb64, _do_getb_signed_64, _do_putb64, + _do_getb32, _do_getb_signed_32, _do_putb32, + _do_getb16, _do_getb_signed_16, _do_putb16, /* hdrs */ { _bfd_dummy_target, hppa_object_p, /* bfd_check_format */ bfd_generic_archive_p, diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index c85be242256..9f03e433afa 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -1,6 +1,6 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - Copyright 1990, 1991 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -31,7 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Set a tdata field. Can't use the other macros for this, since they do casts, and casting to the left of assignment isn't portable. */ -#define set_tdata(bfd, v) ((bfd)->tdata = (PTR) (v)) +#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) /* tdata for an archive. For an input archive, cache needs to be free()'d. For an output archive, symdefs do. */ @@ -46,7 +46,7 @@ struct artdata { char *extended_names; /* clever intel extension */ }; -#define bfd_ardata(bfd) ((struct artdata *) ((bfd)->tdata)) +#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) /* Goes in bfd's arelt_data slot */ struct areltdata { @@ -57,99 +57,104 @@ struct areltdata { #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) -/* FIXME -- a lot of my code allocates a large block and subdivides it. - This can't always work, because of alignment restrictions. We should change - it before it becomes a problem -- Gumby */ - -PROTO (char *, zalloc, (bfd_size_type size)); +char *zalloc PARAMS ((bfd_size_type size)); /* These routines allocate and free things on the BFD's obstack. Note that realloc can never occur in place. */ -PROTO(PTR, bfd_alloc, (bfd *abfd, bfd_size_type size)); -PROTO(PTR, bfd_zalloc,(bfd *abfd, bfd_size_type size)); -PROTO(PTR, bfd_realloc,(bfd *abfd, PTR orig, bfd_size_type new)); -PROTO(void, bfd_alloc_grow,(bfd *abfd, PTR thing, bfd_size_type size)); -PROTO(PTR, bfd_alloc_finish,(bfd *abfd)); - -#define bfd_release(x,y) (void) obstack_free(&(x->memory),y) - - -PROTO (bfd_size_type, bfd_read, (PTR ptr, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -PROTO (bfd_size_type, bfd_write, (CONST PTR ptr, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); - - - -PROTO (int, bfd_seek,(bfd* abfd, file_ptr fp , int direction)); -PROTO (long, bfd_tell, (bfd *abfd)); -PROTO (bfd *, _bfd_create_empty_archive_element_shell, (bfd *obfd)); -PROTO (bfd *, look_for_bfd_in_cache, (bfd *arch_bfd, file_ptr index)); -PROTO (boolean, _bfd_generic_mkarchive, (bfd *abfd)); -PROTO (struct areltdata *, snarf_ar_hdr, (bfd *abfd)); -PROTO (bfd_target *, bfd_generic_archive_p, (bfd *abfd)); -PROTO (boolean, bfd_slurp_bsd_armap, (bfd *abfd)); -PROTO (boolean, bfd_slurp_coff_armap, (bfd *abfd)); -PROTO (boolean, _bfd_slurp_extended_name_table, (bfd *abfd)); -PROTO (boolean, _bfd_write_archive_contents, (bfd *abfd)); -PROTO (bfd *, new_bfd, ()); +PTR bfd_alloc PARAMS ((bfd *abfd, bfd_size_type size)); +PTR bfd_zalloc PARAMS ((bfd *abfd, bfd_size_type size)); +PTR bfd_realloc PARAMS ((bfd *abfd, PTR orig, bfd_size_type new)); +void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, bfd_size_type 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) + + +bfd_size_type bfd_read PARAMS ((PTR ptr, bfd_size_type size, + bfd_size_type nitems, bfd *abfd)); +bfd_size_type bfd_write PARAMS ((CONST PTR ptr, bfd_size_type size, + bfd_size_type nitems, bfd *abfd)); +int bfd_seek PARAMS ((bfd* CONST abfd, CONST file_ptr fp, + CONST int direction)); +long bfd_tell PARAMS ((bfd *abfd)); + +bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); +bfd * look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); +boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); +struct areltdata * snarf_ar_hdr PARAMS ((bfd *abfd)); +bfd_target * bfd_generic_archive_p PARAMS ((bfd *abfd)); +boolean bfd_slurp_armap PARAMS ((bfd *abfd)); +#define bfd_slurp_bsd_armap bfd_slurp_armap +#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 (()); #define DEFAULT_STRING_SPACE_SIZE 0x2000 -PROTO (boolean, bfd_add_to_string_table, (char **table, char *new_string, - unsigned int *table_length, - char **free_ptr)); -PROTO (bfd_vma, _do_getb64, (unsigned char *addr)); -PROTO (bfd_vma, _do_getl64, (unsigned char *addr)); -PROTO (bfd_vma, _do_getb32, (unsigned char *addr)); -PROTO (bfd_vma, _do_getl32, (unsigned char *addr)); -PROTO (bfd_vma, _do_getb16, (unsigned char *addr)); -PROTO (bfd_vma, _do_getl16, (unsigned char *addr)); -PROTO (void, _do_putb64, (bfd_vma data, unsigned char *addr)); -PROTO (void, _do_putl64, (bfd_vma data, unsigned char *addr)); -PROTO (void, _do_putb32, (bfd_vma data, unsigned char *addr)); -PROTO (void, _do_putl32, (bfd_vma data, unsigned char *addr)); -PROTO (void, _do_putb16, (bfd_vma data, unsigned char *addr)); -PROTO (void, _do_putl16, (bfd_vma data, unsigned char *addr)); - -PROTO (boolean, bfd_false, (bfd *ignore)); -PROTO (boolean, bfd_true, (bfd *ignore)); -PROTO (PTR, bfd_nullvoidptr, (bfd *ignore)); -PROTO (int, bfd_0, (bfd *ignore)); -PROTO (unsigned int, bfd_0u, (bfd *ignore)); -PROTO (void, bfd_void, (bfd *ignore)); - -PROTO (bfd *,new_bfd_contained_in,(bfd *)); -PROTO (boolean, _bfd_dummy_new_section_hook, (bfd *ignore, asection *newsect)); -PROTO (char *, _bfd_dummy_core_file_failing_command, (bfd *abfd)); -PROTO (int, _bfd_dummy_core_file_failing_signal, (bfd *abfd)); -PROTO (boolean, _bfd_dummy_core_file_matches_executable_p, (bfd *core_bfd, +boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string, + unsigned int *table_length, + char **free_ptr)); +bfd_vma _do_getb64 PARAMS ((unsigned char *addr)); +bfd_vma _do_getl64 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_64 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_64 PARAMS ((unsigned char *addr)); +bfd_vma _do_getb32 PARAMS ((unsigned char *addr)); +bfd_vma _do_getl32 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_32 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_32 PARAMS ((unsigned char *addr)); +bfd_vma _do_getb16 PARAMS ((unsigned char *addr)); +bfd_vma _do_getl16 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_16 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_16 PARAMS ((unsigned char *addr)); +void _do_putb64 PARAMS ((bfd_vma data, unsigned char *addr)); +void _do_putl64 PARAMS ((bfd_vma data, unsigned char *addr)); +void _do_putb32 PARAMS ((bfd_vma data, unsigned char *addr)); +void _do_putl32 PARAMS ((bfd_vma data, unsigned char *addr)); +void _do_putb16 PARAMS ((bfd_vma data, unsigned char *addr)); +void _do_putl16 PARAMS ((bfd_vma data, unsigned char *addr)); + +boolean bfd_false PARAMS ((bfd *ignore)); +boolean bfd_true PARAMS ((bfd *ignore)); +PTR bfd_nullvoidptr PARAMS ((bfd *ignore)); +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 *)); +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)); +boolean _bfd_dummy_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); -PROTO (bfd_target *, _bfd_dummy_target, (bfd *abfd)); +bfd_target * _bfd_dummy_target PARAMS ((bfd *abfd)); -PROTO (void, bfd_dont_truncate_arname, (bfd *abfd, CONST char *filename, +void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, char *hdr)); -PROTO (void, bfd_bsd_truncate_arname, (bfd *abfd, CONST char *filename, +void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, char *hdr)); -PROTO (void, bfd_gnu_truncate_arname, (bfd *abfd, CONST char *filename, +void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, char *hdr)); -PROTO (boolean, bsd_write_armap, (bfd *arch, unsigned int elength, +boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)); -PROTO (boolean, coff_write_armap, (bfd *arch, unsigned int elength, +boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)); -PROTO (bfd *, bfd_generic_openr_next_archived_file, (bfd *archive, +bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive, bfd *last_file)); -PROTO(int, bfd_generic_stat_arch_elt, (bfd *, struct stat *)); +int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); -PROTO(boolean, bfd_generic_get_section_contents, - (bfd *abfd, sec_ptr section, PTR location, file_ptr offset, - bfd_size_type count)); +boolean bfd_generic_get_section_contents PARAMS ((bfd *abfd, sec_ptr section, + PTR location, file_ptr offset, + bfd_size_type count)); -PROTO(boolean, bfd_generic_set_section_contents, - (bfd *abfd, sec_ptr section, PTR location, file_ptr offset, - bfd_size_type count)); +boolean bfd_generic_set_section_contents PARAMS ((bfd *abfd, sec_ptr section, + PTR location, file_ptr offset, + bfd_size_type count)); /* Macros to tell if bfds are read or write enabled. @@ -160,17 +165,18 @@ PROTO(boolean, bfd_generic_set_section_contents, !bfd_read_p, and only sometimes bfd_write_p. */ -#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) -#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) +#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) +#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) + +void bfd_assert PARAMS ((char*,int)); -PROTO (void, bfd_assert,(char*,int)); #define BFD_ASSERT(x) \ { if (!(x)) bfd_assert(__FILE__,__LINE__); } #define BFD_FAIL() \ { bfd_assert(__FILE__,__LINE__); } -PROTO (FILE *, bfd_cache_lookup_worker, (bfd *)); +FILE * bfd_cache_lookup_worker PARAMS ((bfd *)); extern bfd *bfd_last_cache; @@ -186,23 +192,5 @@ extern bfd *bfd_last_cache; /* Generic routine for close_and_cleanup is really just bfd_true. */ #define bfd_generic_close_and_cleanup bfd_true -/* THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/ - -/*:init.c*/ - -/*:libbfd.c*/ - -/*:cache.c*/ - -/*:ctor.c*/ - -/*:reloc.c*/ - -/*:cpu-h8300.c*/ - -/*:cpu-i960.c*/ - -/*:cpu-empty.c*/ - -/*:archures.c*/ +/* And more follows */ diff --git a/bfd/libbfd.c b/bfd/libbfd.c index a4624496625..aa5e6af4dac 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -400,24 +400,38 @@ DESCRIPTION sections; each access (except for bytes) is vectored through the target format of the BFD and mangled accordingly. The mangling performs any necessary endian translations and - removes alignment restrictions. + removes alignment restrictions. Note that types accepted and + returned by these macros are identical so they can be swapped + around in macros--for example libaout.h defines GET_WORD to + either bfd_get_32 or bfd_get_64. .#define bfd_put_8(abfd, val, ptr) \ -. (*((char *)ptr) = (char)val) +. (*((unsigned char *)ptr) = (unsigned char)val) +.#define bfd_put_signed_8(abfd, val, ptr) (*((char *)(ptr)) = (char)(val)) .#define bfd_get_8(abfd, ptr) \ -. (*((char *)ptr)) +. (*((unsigned char *)(ptr))) +.#define bfd_get_signed_8(abfd, ptr) (((*(char *)(ptr) ^ 0x80) & 0xff) - 0x80) .#define bfd_put_16(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx16, (val,ptr)) +. BFD_SEND(abfd, bfd_putx16, ((bfd_vma)(val),(ptr))) +.#define bfd_put_signed_16 bfd_put_16 .#define bfd_get_16(abfd, ptr) \ . BFD_SEND(abfd, bfd_getx16, (ptr)) +.#define bfd_get_signed_16(abfd, ptr) \ +. BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) .#define bfd_put_32(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx32, (val,ptr)) +. BFD_SEND(abfd, bfd_putx32, ((bfd_vma)(val),(ptr))) +.#define bfd_put_signed_32 bfd_put_32 .#define bfd_get_32(abfd, ptr) \ . BFD_SEND(abfd, bfd_getx32, (ptr)) +.#define bfd_get_signed_32(abfd, ptr) \ +. BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) .#define bfd_put_64(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx64, (val, ptr)) +. BFD_SEND(abfd, bfd_putx64, ((bfd_vma)(val), (ptr))) +.#define bfd_put_signed_64 bfd_put_64 .#define bfd_get_64(abfd, ptr) \ . BFD_SEND(abfd, bfd_getx64, (ptr)) +.#define bfd_get_signed_64(abfd, ptr) \ +. BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) */ @@ -435,24 +449,41 @@ DESCRIPTION order, and their data in little endan order. .#define bfd_h_put_8(abfd, val, ptr) \ -. (*((char *)ptr) = (char)val) +. (*((unsigned char *)ptr) = (unsigned char)val) +.#define bfd_h_put_signed_8(abfd, val, ptr) (*((char *)(ptr)) = (char)(val)) .#define bfd_h_get_8(abfd, ptr) \ -. (*((char *)ptr)) +. (*((unsigned char *)(ptr))) +.#define bfd_h_get_signed_8 bfd_get_signed_8 .#define bfd_h_put_16(abfd, val, ptr) \ . BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) +.#define bfd_h_put_signed_16 bfd_h_put_16 .#define bfd_h_get_16(abfd, ptr) \ . BFD_SEND(abfd, bfd_h_getx16,(ptr)) +.#define bfd_h_get_signed_16(abfd, ptr) \ +. BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) .#define bfd_h_put_32(abfd, val, ptr) \ . BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) +.#define bfd_h_put_signed_32 bfd_h_put_32 .#define bfd_h_get_32(abfd, ptr) \ . BFD_SEND(abfd, bfd_h_getx32,(ptr)) +.#define bfd_h_get_signed_32(abfd, ptr) \ +. BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) .#define bfd_h_put_64(abfd, val, ptr) \ . BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) +.#define bfd_h_put_signed_64 bfd_h_put_64 .#define bfd_h_get_64(abfd, ptr) \ . BFD_SEND(abfd, bfd_h_getx64,(ptr)) +.#define bfd_h_get_signed_64(abfd, ptr) \ +. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) */ +/* Sign extension to bfd_signed_vma. */ +#define COERCE16(x) ((bfd_signed_vma) (((x) ^ 0x8000) - 0x8000)) +#define COERCE32(x) ((bfd_signed_vma) (((x) ^ 0x80000000) - 0x80000000)) +#define COERCE64(x) ((bfd_signed_vma)\ + (((x) ^ 0x8000000000000000) - 0x8000000000000000)) + bfd_vma DEFUN(_do_getb16,(addr), register bfd_byte *addr) @@ -467,6 +498,20 @@ DEFUN(_do_getl16,(addr), return (addr[1] << 8) | addr[0]; } +bfd_signed_vma +DEFUN(_do_getb_signed_16,(addr), + register bfd_byte *addr) +{ + return COERCE16((addr[0] << 8) | addr[1]); +} + +bfd_signed_vma +DEFUN(_do_getl_signed_16,(addr), + register bfd_byte *addr) +{ + return COERCE16((addr[1] << 8) | addr[0]); +} + void DEFUN(_do_putb16,(data, addr), bfd_vma data AND @@ -486,8 +531,8 @@ DEFUN(_do_putl16,(data, addr), } bfd_vma -DEFUN(_do_getb32,(addr), - register bfd_byte *addr) +_do_getb32 (addr) + register bfd_byte *addr; { return ((((addr[0] << 8) | addr[1]) << 8) | addr[2]) << 8 | addr[3]; } @@ -499,6 +544,22 @@ _do_getl32 (addr) return ((((addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0]; } +bfd_signed_vma +_do_getb_signed_32 (addr) + register bfd_byte *addr; +{ + return COERCE32(((((addr[0] << 8) | addr[1]) << 8) + | addr[2]) << 8 | addr[3]); +} + +bfd_signed_vma +_do_getl_signed_32 (addr) + register bfd_byte *addr; +{ + return COERCE32(((((addr[3] << 8) | addr[2]) << 8) + | addr[1]) << 8 | addr[0]); +} + bfd_vma DEFUN(_do_getb64,(addr), register bfd_byte *addr) @@ -549,6 +610,56 @@ DEFUN(_do_getl64,(addr), } +bfd_signed_vma +DEFUN(_do_getb_signed_64,(addr), + register bfd_byte *addr) +{ +#ifdef HOST_64_BIT + bfd_vma low, high; + + high= ((((((((addr[0]) << 8) | + addr[1]) << 8) | + addr[2]) << 8) | + addr[3]) ); + + low = ((((((((addr[4]) << 8) | + addr[5]) << 8) | + addr[6]) << 8) | + addr[7])); + + return COERCE64(high << 32 | low); +#else + BFD_FAIL(); + return 0; +#endif + +} + +bfd_signed_vma +DEFUN(_do_getl_signed_64,(addr), + register bfd_byte *addr) +{ + +#ifdef HOST_64_BIT + bfd_vma low, high; + high= (((((((addr[7] << 8) | + addr[6]) << 8) | + addr[5]) << 8) | + addr[4])); + + low = (((((((addr[3] << 8) | + addr[2]) << 8) | + addr[1]) << 8) | + addr[0]) ); + + return COERCE64(high << 32 | low); +#else + BFD_FAIL(); + return 0; +#endif + +} + void DEFUN(_do_putb32,(data, addr), bfd_vma data AND diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 67341cb9e5a..f889b228d2c 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1,6 +1,6 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - Copyright 1990, 1991 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -98,10 +98,16 @@ boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string, char **free_ptr)); bfd_vma _do_getb64 PARAMS ((unsigned char *addr)); bfd_vma _do_getl64 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_64 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_64 PARAMS ((unsigned char *addr)); bfd_vma _do_getb32 PARAMS ((unsigned char *addr)); bfd_vma _do_getl32 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_32 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_32 PARAMS ((unsigned char *addr)); bfd_vma _do_getb16 PARAMS ((unsigned char *addr)); bfd_vma _do_getl16 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getb_signed_16 PARAMS ((unsigned char *addr)); +bfd_signed_vma _do_getl_signed_16 PARAMS ((unsigned char *addr)); void _do_putb64 PARAMS ((bfd_vma data, unsigned char *addr)); void _do_putl64 PARAMS ((bfd_vma data, unsigned char *addr)); void _do_putb32 PARAMS ((bfd_vma data, unsigned char *addr)); @@ -200,18 +206,6 @@ bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i)); bfd_vma bfd_log2 PARAMS ((bfd_vma x)); -void -bfd_check_init PARAMS ((void)); - -PTR -bfd_xmalloc PARAMS (( bfd_size_type size)); - -void -bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i)); - -bfd_vma -bfd_log2 PARAMS ((bfd_vma x)); - #define BFD_CACHE_MAX_OPEN 10 extern bfd *bfd_last_cache; @@ -238,7 +232,7 @@ bfd_constructor_entry PARAMS ((bfd *abfd, CONST struct reloc_howto_struct * bfd_default_reloc_type_lookup - PARAMS ((CONST struct bfd_arch_info *, + PARAMS ((bfd *abfd AND bfd_reloc_code_real_type code)); boolean @@ -251,7 +245,14 @@ bfd_byte * bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd, struct bfd_seclet *seclet, - bfd_byte *data)); + bfd_byte *data, + boolean relocateable)); + +boolean +bfd_generic_seclet_link + PARAMS ((bfd *abfd, + PTR data, + boolean relocateable)); extern bfd_arch_info_type bfd_default_arch_struct; boolean @@ -273,6 +274,6 @@ bfd_default_compatible boolean bfd_default_scan PARAMS ((CONST struct bfd_arch_info *, CONST char *)); -Elf_Internal_Shdr * +struct elf_internal_shdr * bfd_elf_find_section PARAMS ((bfd *abfd, char *name)); diff --git a/bfd/targets.c b/bfd/targets.c index fdf5d220377..f9ba26d2b31 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -180,19 +180,25 @@ entry points, since they don't take BFD as first arg. Certain other handlers could do the same. . bfd_vma (*bfd_getx64) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((bfd_byte *)); . void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); . bfd_vma (*bfd_getx32) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((bfd_byte *)); . void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); . bfd_vma (*bfd_getx16) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((bfd_byte *)); . void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); Byte swapping for the headers . bfd_vma (*bfd_h_getx64) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((bfd_byte *)); . void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); . bfd_vma (*bfd_h_getx32) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((bfd_byte *)); . void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); . bfd_vma (*bfd_h_getx16) PARAMS ((bfd_byte *)); +. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((bfd_byte *)); . void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); Format dependent routines: these are vectors of entry points @@ -299,10 +305,8 @@ Symbols and relocations . void *ptr, . unsigned long size)); -Data for use by back-end routines; e.g., for a.out, includes whether -this particular target maps ZMAGIC files contiguously or with text and -data separated. Could perhaps also be used to eliminate some of the -above COFF-specific fields. +Data for use by back-end routines, which isn't generic enough to belong +in this structure. . PTR backend_data; .} bfd_target; @@ -348,8 +352,10 @@ extern bfd_target b_out_vec_little_host; extern bfd_target b_out_vec_big_host; extern bfd_target icoff_little_vec; extern bfd_target icoff_big_vec; -extern bfd_target elf_little_vec; -extern bfd_target elf_big_vec; +extern bfd_target elf32_sparc_vec; +extern bfd_target elf32_i386_vec; +extern bfd_target elf32_m68k_vec; +extern bfd_target elf32_i860_vec; extern bfd_target ieee_vec; extern bfd_target oasys_vec; extern bfd_target m88kbcs_vec; @@ -378,8 +384,10 @@ extern bfd_target DEFAULT_VECTOR; bfd_target *target_vector[] = { #ifdef SELECT_VECS - SELECT_VECS, -#else /* SELECT_VECS */ + + SELECT_VECS, + +#else /* not SELECT_VECS */ #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, @@ -412,8 +420,10 @@ bfd_target *target_vector[] = { /* &tekhex_vec,*/ &icoff_little_vec, &icoff_big_vec, - &elf_little_vec, - &elf_big_vec, + &elf32_sparc_vec, + &elf32_i386_vec, + &elf32_m68k_vec, + &elf32_i860_vec, &a_out_adobe_vec, &b_out_vec_little_host, &b_out_vec_big_host, @@ -435,7 +445,7 @@ bfd_target *target_vector[] = { &aix386_core_vec, #endif -#endif /* SELECT_VECS */ +#endif /* not SELECT_VECS */ NULL, /* end of list marker */ }; diff --git a/include/bfd.h b/include/bfd.h index 73ba9d5f453..371a7f10b01 100644 --- a/include/bfd.h +++ b/include/bfd.h @@ -68,29 +68,37 @@ typedef enum bfd_boolean {false, true} boolean; /* typedef off_t file_ptr; */ typedef long int file_ptr; -/* Support for different sizes of target format ints and addresses */ +/* Support for different sizes of target format ints and addresses. + If the host implements--and wants BFD to use--64-bit values, it + defines HOST_64_BIT (in BFD and in every program that calls it -- + since this affects declarations in bfd.h). */ #ifdef HOST_64_BIT -typedef HOST_64_BIT rawdata_offset; -typedef HOST_64_BIT bfd_vma; -typedef HOST_64_BIT bfd_word; -typedef HOST_64_BIT bfd_offset; -typedef HOST_64_BIT bfd_size_type; -typedef HOST_64_BIT symvalue; -typedef HOST_64_BIT bfd_64_type; +typedef unsigned HOST_64_BIT bfd_vma; +typedef HOST_64_BIT bfd_signed_vma; +typedef unsigned HOST_64_BIT bfd_size_type; +typedef unsigned HOST_64_BIT symvalue; #define fprintf_vma(s,x) \ fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x)) -#else -typedef struct {int a,b;} bfd_64_type; -typedef unsigned long rawdata_offset; +#else /* not HOST_64_BIT. */ + +/* Represent a target address. Also used as a generic unsigned type + which is guaranteed to be big enough to hold any arithmetic types + we need to deal with. */ typedef unsigned long bfd_vma; -typedef unsigned long bfd_offset; -typedef unsigned long bfd_word; -typedef unsigned long bfd_size; + +/* A generic signed type which is guaranteed to be big enough to hold any + arithmetic types we need to deal with. Can be assumed to be compatible + with bfd_vma in the same way that signed and unsigned ints are compatible + (as parameters, in assignment, etc). */ +typedef long bfd_signed_vma; + typedef unsigned long symvalue; typedef unsigned long bfd_size_type; + +/* Print a bfd_vma x on stream s. */ #define fprintf_vma(s,x) fprintf(s, "%08lx", x) -#endif +#endif /* not HOST_64_BIT. */ #define printf_vma(x) fprintf_vma(stdout,x) typedef unsigned int flagword; /* 32 bits of flags */ @@ -364,37 +372,59 @@ bfd * bfd_create PARAMS ((CONST char *filename, bfd *template)); #define bfd_put_8(abfd, val, ptr) \ - (*((char *)ptr) = (char)val) + (*((unsigned char *)ptr) = (unsigned char)val) +#define bfd_put_signed_8(abfd, val, ptr) (*((char *)(ptr)) = (char)(val)) #define bfd_get_8(abfd, ptr) \ - (*((char *)ptr)) + (*((unsigned char *)(ptr))) +#define bfd_get_signed_8(abfd, ptr) (((*(char *)(ptr) ^ 0x80) & 0xff) - 0x80) #define bfd_put_16(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx16, (val,ptr)) + BFD_SEND(abfd, bfd_putx16, ((bfd_vma)(val),(ptr))) +#define bfd_put_signed_16 bfd_put_16 #define bfd_get_16(abfd, ptr) \ BFD_SEND(abfd, bfd_getx16, (ptr)) +#define bfd_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) #define bfd_put_32(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx32, (val,ptr)) + BFD_SEND(abfd, bfd_putx32, ((bfd_vma)(val),(ptr))) +#define bfd_put_signed_32 bfd_put_32 #define bfd_get_32(abfd, ptr) \ BFD_SEND(abfd, bfd_getx32, (ptr)) +#define bfd_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) #define bfd_put_64(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx64, (val, ptr)) + BFD_SEND(abfd, bfd_putx64, ((bfd_vma)(val), (ptr))) +#define bfd_put_signed_64 bfd_put_64 #define bfd_get_64(abfd, ptr) \ BFD_SEND(abfd, bfd_getx64, (ptr)) +#define bfd_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) #define bfd_h_put_8(abfd, val, ptr) \ - (*((char *)ptr) = (char)val) + (*((unsigned char *)ptr) = (unsigned char)val) +#define bfd_h_put_signed_8(abfd, val, ptr) (*((char *)(ptr)) = (char)(val)) #define bfd_h_get_8(abfd, ptr) \ - (*((char *)ptr)) + (*((unsigned char *)(ptr))) +#define bfd_h_get_signed_8 bfd_get_signed_8 #define bfd_h_put_16(abfd, val, ptr) \ BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) +#define bfd_h_put_signed_16 bfd_h_put_16 #define bfd_h_get_16(abfd, ptr) \ BFD_SEND(abfd, bfd_h_getx16,(ptr)) +#define bfd_h_get_signed_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) #define bfd_h_put_32(abfd, val, ptr) \ BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) +#define bfd_h_put_signed_32 bfd_h_put_32 #define bfd_h_get_32(abfd, ptr) \ BFD_SEND(abfd, bfd_h_getx32,(ptr)) +#define bfd_h_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) #define bfd_h_put_64(abfd, val, ptr) \ BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) +#define bfd_h_put_signed_64 bfd_h_put_64 #define bfd_h_get_64(abfd, ptr) \ BFD_SEND(abfd, bfd_h_getx64,(ptr)) +#define bfd_h_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) typedef struct sec { /* The name of the section, the name isn't a copy, the pointer is @@ -787,7 +817,7 @@ typedef enum bfd_reloc_status /* The relocation was performed, but there was an overflow. */ bfd_reloc_overflow, - /* The address to relocate was not within the section supplied*/ + /* The address to relocate was not within the section supplied. */ bfd_reloc_outofrange, /* Used by special functions */ @@ -796,10 +826,10 @@ typedef enum bfd_reloc_status /* Unused */ bfd_reloc_notsupported, - /* Unsupported relocation size requested. */ + /* Unsupported relocation size requested. */ bfd_reloc_other, - /* The symbol to relocate against was undefined.*/ + /* The symbol to relocate against was undefined. */ bfd_reloc_undefined, /* The relocation was performed, but may not be ok - presently @@ -816,7 +846,7 @@ typedef struct reloc_cache_entry struct symbol_cache_entry **sym_ptr_ptr; /* offset in section */ - rawdata_offset address; + bfd_size_type address; /* addend for relocation value */ bfd_vma addend; @@ -889,13 +919,13 @@ typedef CONST struct reloc_howto_struct sun4 extended relocs, the value in the offset part of a relocating field is garbage so we never use it. In this case the mask would be 0x00000000. */ - bfd_word src_mask; + bfd_vma src_mask; /* The dst_mask is what parts of the instruction are replaced into the instruction. In most cases src_mask == dst_mask, except in the above special case, where dst_mask would be 0x000000ff, and src_mask would be 0x00000000. */ - bfd_word dst_mask; + bfd_vma dst_mask; /* When some formats create PC relative instructions, they leave the value of the pc of the place being relocated in the offset @@ -1406,16 +1436,22 @@ typedef struct bfd_target unsigned short ar_max_namelen; unsigned int align_power_min; bfd_vma (*bfd_getx64) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((bfd_byte *)); void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); bfd_vma (*bfd_getx32) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((bfd_byte *)); void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); bfd_vma (*bfd_getx16) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((bfd_byte *)); void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); bfd_vma (*bfd_h_getx64) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((bfd_byte *)); void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); bfd_vma (*bfd_h_getx32) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((bfd_byte *)); void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); bfd_vma (*bfd_h_getx16) PARAMS ((bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((bfd_byte *)); void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); -- 2.30.2