diff options
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/aout-encap.c | 6 | ||||
-rw-r--r-- | bfd/aoutx.h | 10 | ||||
-rw-r--r-- | bfd/archive.c | 2 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 8 | ||||
-rw-r--r-- | bfd/bout.c | 24 | ||||
-rw-r--r-- | bfd/coff-a29k.c | 2 | ||||
-rw-r--r-- | bfd/coff-alpha.c | 10 | ||||
-rw-r--r-- | bfd/coff-go32.c | 358 | ||||
-rw-r--r-- | bfd/coff-h8300.c | 7 | ||||
-rw-r--r-- | bfd/coff-h8500.c | 3 | ||||
-rw-r--r-- | bfd/coff-mips.c | 4 | ||||
-rw-r--r-- | bfd/coff-sh.c | 3 | ||||
-rw-r--r-- | bfd/coff-z8k.c | 3 | ||||
-rw-r--r-- | bfd/coffgen.c | 10 | ||||
-rw-r--r-- | bfd/ecoff.c | 8 | ||||
-rw-r--r-- | bfd/elf32-target.h | 4 | ||||
-rw-r--r-- | bfd/elf64-target.h | 4 | ||||
-rw-r--r-- | bfd/elfcode.h | 8 | ||||
-rw-r--r-- | bfd/i386lynx.c | 20 | ||||
-rw-r--r-- | bfd/ieee.c | 26 | ||||
-rw-r--r-- | bfd/libelf.h | 8 | ||||
-rw-r--r-- | bfd/m68klynx.c | 2 | ||||
-rw-r--r-- | bfd/mipsbsd.c | 4 | ||||
-rw-r--r-- | bfd/nlmcode.h | 5 | ||||
-rw-r--r-- | bfd/oasys.c | 15 | ||||
-rw-r--r-- | bfd/som.c | 16 | ||||
-rw-r--r-- | bfd/srec.c | 32 | ||||
-rw-r--r-- | bfd/tekhex.c | 10 |
29 files changed, 494 insertions, 123 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bce328d..a47c441 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ Mon Jun 20 11:06:27 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + * Many files: change all bfd_target vectors to be const. Change + all uses of bfd_target * to be const bfd_target *. Change + bfd_target_vector and bfd_default_vector arrays to be const + bfd_target * const *. + * ecoff.c, libecoff.h, ecoffswap.h, coff-alpha.c, coff-mips.c, elf32-mips.c: Renamed all externally visible ECOFF routines which are local to BFD to start with _bfd_ecoff instead of just ecoff. diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c index 56c1936..6c3772e 100644 --- a/bfd/aout-encap.c +++ b/bfd/aout-encap.c @@ -35,9 +35,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "aout/ar.h" #include "libaout.h" /* BFD a.out internal data structures */ -bfd_target *encap_real_callback (); +const bfd_target *encap_real_callback (); -bfd_target * +const bfd_target * encap_object_p (abfd) bfd *abfd; { @@ -79,7 +79,7 @@ encap_object_p (abfd) } /* Finish up the reading of a encapsulated-coff a.out file header */ -bfd_target * +const bfd_target * encap_real_callback (abfd) bfd *abfd; { diff --git a/bfd/aoutx.h b/bfd/aoutx.h index da0fa74..7239ac9 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -383,9 +383,9 @@ FUNCTION aout_@var{size}_some_aout_object_p SYNOPSIS - bfd_target *aout_@var{size}_some_aout_object_p + const bfd_target *aout_@var{size}_some_aout_object_p (bfd *abfd, - bfd_target *(*callback_to_real_object_p)()); + const bfd_target *(*callback_to_real_object_p)()); DESCRIPTION Some a.out variant thinks that the file open in @var{abfd} @@ -395,14 +395,14 @@ DESCRIPTION handle any last-minute setup. */ -bfd_target * +const bfd_target * NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) bfd *abfd; struct internal_exec *execp; - bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); + const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); { struct aout_data_struct *rawptr, *oldrawptr; - bfd_target *result; + const bfd_target *result; rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); if (rawptr == NULL) { diff --git a/bfd/archive.c b/bfd/archive.c index ce79af4..9573994 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -627,7 +627,7 @@ bfd_generic_openr_next_archived_file (archive, last_file) } -bfd_target * +const bfd_target * bfd_generic_archive_p (abfd) bfd *abfd; { diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 80c45d7..62ee6dc 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1578,7 +1578,7 @@ struct _bfd CONST char *filename; /* A pointer to the target jump table. */ - struct bfd_target *xvec; + const struct bfd_target *xvec; /* To avoid dragging too many header files into every file that includes `<<bfd.h>>', IOSTREAM has been declared as a "char @@ -1938,7 +1938,7 @@ typedef struct bfd_target bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); - struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); @@ -2106,10 +2106,10 @@ CAT(NAME,_canonicalize_dynamic_reloc) PTR backend_data; } bfd_target; -bfd_target * +const bfd_target * bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd)); -CONST char ** +const char ** bfd_target_list PARAMS ((void)); boolean @@ -35,7 +35,7 @@ static int aligncode PARAMS ((bfd *abfd, asection *input_section, 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 bfd_target *b_out_callback PARAMS ((bfd *)); +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 *)); @@ -114,7 +114,7 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes) } -static bfd_target * +static const bfd_target * b_out_object_p (abfd) bfd *abfd; { @@ -143,7 +143,7 @@ b_out_object_p (abfd) /* Finish up the opening of a b.out file for reading. Fill in all the fields that are not handled by common code. */ -static bfd_target * +static const bfd_target * b_out_callback (abfd) bfd *abfd; { @@ -212,15 +212,10 @@ b_out_mkobject (abfd) abfd->tdata.bout_data = rawptr; exec_hdr (abfd) = &rawptr->e; - /* For simplicity's sake we just make all the sections right here. */ obj_textsec (abfd) = (asection *)NULL; obj_datasec (abfd) = (asection *)NULL; obj_bsssec (abfd) = (asection *)NULL; - bfd_make_section (abfd, ".text"); - bfd_make_section (abfd, ".data"); - bfd_make_section (abfd, ".bss"); - return true; } @@ -230,6 +225,9 @@ b_out_write_object_contents (abfd) { struct external_exec swapped_hdr; + if (! aout_32_make_sections (abfd)) + return false; + exec_hdr (abfd)->a_info = BMAGIC; exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size; @@ -439,6 +437,7 @@ b_out_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_I960_CALLJ: return &howto_reloc_callj; case BFD_RELOC_32: + case BFD_RELOC_CTOR: return &howto_reloc_abs32; case BFD_RELOC_24_PCREL: return &howto_reloc_pcrel24; @@ -867,11 +866,8 @@ b_out_set_section_contents (abfd, section, location, offset, count) { if (abfd->output_has_begun == false) { /* set by bfd.c handler */ - if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL) /*|| - (obj_textsec (abfd)->_cooked_size == 0) || (obj_datasec (abfd)->_cooked_size == 0)*/) { - bfd_set_error (bfd_error_invalid_operation); + if (! aout_32_make_sections (abfd)) return false; - } obj_textsec (abfd)->filepos = sizeof(struct internal_exec); obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos @@ -1363,7 +1359,7 @@ b_out_bfd_get_relocated_section_contents (in_abfd, link_info, link_order, #define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols #define b_out_bfd_final_link _bfd_generic_final_link -bfd_target b_out_vec_big_host = +const bfd_target b_out_vec_big_host = { "b.out.big", /* name */ bfd_target_aout_flavour, @@ -1405,7 +1401,7 @@ bfd_target b_out_vec_big_host = }; -bfd_target b_out_vec_little_host = +const bfd_target b_out_vec_little_host = { "b.out.little", /* name */ bfd_target_aout_flavour, diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index 42127ec..13897a9 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -304,7 +304,7 @@ reloc_processing (relent,reloc, symbols, abfd, section) #include "coffcode.h" -bfd_target a29kcoff_big_vec = +const bfd_target a29kcoff_big_vec = { "coff-a29k-big", /* name */ bfd_target_coff_flavour, diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 1cdb340..1bbfbdb 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for static functions. */ -static bfd_target *alpha_ecoff_object_p PARAMS ((bfd *)); +static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *)); static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr)); static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, struct internal_reloc *)); @@ -421,15 +421,15 @@ static reloc_howto_type alpha_howto_table[] = /* Recognize an Alpha ECOFF file. */ -static bfd_target * +static const bfd_target * alpha_ecoff_object_p (abfd) bfd *abfd; { - static bfd_target *ret; + static const bfd_target *ret; ret = coff_object_p (abfd); - if (ret != (bfd_target *) NULL) + if (ret != NULL) { asection *sec; @@ -1995,7 +1995,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = /* Relaxing sections is generic. */ #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section -bfd_target ecoffalpha_little_vec = +const bfd_target ecoffalpha_little_vec = { "ecoff-littlealpha", /* name */ bfd_target_ecoff_flavour, diff --git a/bfd/coff-go32.c b/bfd/coff-go32.c new file mode 100644 index 0000000..a26f8f3 --- /dev/null +++ b/bfd/coff-go32.c @@ -0,0 +1,358 @@ +/* BFD back-end for Intel 386 COFF files (go32 variant). + Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Written by DJ Delorie. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "obstack.h" +#include "coff/i386.h" +#include "coff/internal.h" +#include "libcoff.h" + +static bfd_reloc_status_type coff_go32_reloc PARAMS ((bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); + +/* For some reason when using i386 COFF the value stored in the .text + section for a reference to a common symbol is the value itself plus + any desired offset. Ian Taylor, Cygnus Support. */ + +/* If we are producing relocateable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +coff_go32_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocateable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + const reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +static reloc_howto_type howto_table[] = +{ + {0}, + {1}, + {2}, + {3}, + {4}, + {5}, + HOWTO (R_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "dir32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + {7}, + {010}, + {011}, + {012}, + {013}, + {014}, + {015}, + {016}, + HOWTO (R_RELBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "8", /* name */ + true, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_RELWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "16", /* name */ + true, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_RELLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_PCRBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "DISP8", /* name */ + true, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_PCRWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "DISP16", /* name */ + true, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_PCRLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_go32_reloc, /* special_function */ + "DISP32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false) /* pcrel_offset */ +}; + +/* Turn a howto into a reloc nunmber */ + +#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +#define BADMAG(x) I386BADMAG(x) +#define I386 1 /* Customize coffcode.h */ + +#define RTYPE2HOWTO(cache_ptr, dst) \ + cache_ptr->howto = howto_table + (dst)->r_type; + +/* On SCO Unix 3.2.2 the native assembler generates two .data + sections. We handle that by renaming the second one to .data2. It + does no harm to do this for any 386 COFF target. */ +#define TWO_DATA_SECS + +/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared + library. On some other COFF targets STYP_BSS is normally + STYP_NOLOAD. */ +#define BSS_NOLOAD_IS_SHARED_LIBRARY + +/* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the + time this is called, the linker may be using a different symbol + from a different object file with a different value. Therefore, we + hack wildly to locate the original symbol from this file so that we + can make the correct adjustment. This macro sets coffsym to the + symbol from the original file, and uses it to set the addend value + correctly. If this is not a common symbol, the usual addend + calculation is done, except that an additional tweak is needed for + PC relative relocs. + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = - coffsym->native->u.syment.n_value; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } + +#include "coffcode.h" + +static const bfd_target * +go32coff_object_p(a) + bfd *a; +{ + return coff_object_p(a); +} + +static const bfd_target * +go32coff_archive_p(a) + bfd *a; +{ + return 0; +} + +const bfd_target +#ifdef TARGET_SYM + TARGET_SYM = +#else + go32coff_vec = +#endif +{ +#ifdef TARGET_NAME + TARGET_NAME, +#else + "coff-go32", /* name */ +#endif + bfd_target_coff_flavour, + false, /* data byte order is little */ + false, /* header byte order is little */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + + 2, /* minimum alignment power */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + +/* Note that we allow an object file to be treated as a core file as well. */ + {_bfd_dummy_target, go32coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, go32coff_object_p}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + COFF_SWAP_TABLE, +}; diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 8c7af9b..14ac3d3 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -41,7 +41,7 @@ static reloc_howto_type howto_table[] = HOWTO (R_JMP2, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "pcrecl/16", true, 0x000000ff, 0x000000ff, false), - HOWTO (R_JMPL1, 0, 1, 32, false, 0, complain_overflow_bitfield, 0, "24/pcrell", true, 0x0000ffff, 0x0000ffff, false), + HOWTO (R_JMPL1, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "24/pcrell", true, 0x00ffffff, 0x00ffffff, false), HOWTO (R_JMPL_B8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "pc8/24", true, 0x000000ff, 0x000000ff, false), HOWTO (R_MOVLB1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "24/8", true, 0x0000ffff, 0x0000ffff, false), @@ -342,7 +342,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, + dst_address + link_order->u.indirect.section->output_section->vma; int gap = (bfd_coff_reloc16_get_value (reloc, link_info, input_section) - - dot) + 1; + - dot) - 1; if (gap > 32767 || gap < -32768) { if (! ((*link_info->callbacks->reloc_overflow) @@ -562,7 +562,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, -bfd_target h8300coff_vec = +const bfd_target h8300coff_vec = { "coff-h8300", /* name */ bfd_target_coff_flavour, @@ -599,6 +599,7 @@ bfd_target h8300coff_vec = BFD_JUMP_TABLE_RELOCS (coff), BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), COFF_SWAP_TABLE, }; diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index bc80a22..aa0be2c 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -309,7 +309,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) bfd_coff_reloc16_get_relocated_section_contents #define coff_bfd_relax_section bfd_coff_reloc16_relax_section -bfd_target h8500coff_vec = +const bfd_target h8500coff_vec = { "coff-h8500", /* name */ bfd_target_coff_flavour, @@ -347,6 +347,7 @@ bfd_target h8500coff_vec = BFD_JUMP_TABLE_RELOCS (coff), BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), COFF_SWAP_TABLE, }; diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 768821e..97b7294 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -2359,7 +2359,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Relaxing sections is MIPS specific. */ #define _bfd_ecoff_bfd_relax_section mips_relax_section -bfd_target ecoff_little_vec = +const bfd_target ecoff_little_vec = { "ecoff-littlemips", /* name */ bfd_target_ecoff_flavour, @@ -2403,7 +2403,7 @@ bfd_target ecoff_little_vec = (PTR) &mips_ecoff_backend_data }; -bfd_target ecoff_big_vec = +const bfd_target ecoff_big_vec = { "ecoff-bigmips", /* name */ bfd_target_ecoff_flavour, diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 00b1602..1964eea 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -153,7 +153,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) bfd_coff_reloc16_get_relocated_section_contents #define coff_bfd_relax_section bfd_coff_reloc16_relax_section -bfd_target shcoff_vec = +const bfd_target shcoff_vec = { "coff-sh", /* name */ bfd_target_coff_flavour, @@ -191,6 +191,7 @@ bfd_getb64, bfd_getb_signed_64, bfd_putb64, BFD_JUMP_TABLE_RELOCS (coff), BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), COFF_SWAP_TABLE, }; diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 4681dd4..fc074a5 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -235,7 +235,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) bfd_coff_reloc16_get_relocated_section_contents #define coff_bfd_relax_section bfd_coff_reloc16_relax_section -bfd_target z8kcoff_vec = +const bfd_target z8kcoff_vec = { "coff-z8k", /* name */ bfd_target_coff_flavour, @@ -273,6 +273,7 @@ bfd_target z8kcoff_vec = BFD_JUMP_TABLE_RELOCS (coff), BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), COFF_SWAP_TABLE, }; diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 3542ded..33a85cf 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -119,8 +119,7 @@ make_a_section_from_file (abfd, hdr, target_index) /* Read in a COFF object and make it into a BFD. This is used by ECOFF as well. */ -static -bfd_target * +static const bfd_target * coff_real_object_p (abfd, nscns, internal_f, internal_a) bfd *abfd; unsigned nscns; @@ -175,6 +174,9 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) if (!(internal_f->f_flags & F_LSYMS)) abfd->flags |= HAS_LOCALS; + /* FIXME: How can we set D_PAGED correctly? */ + if ((internal_f->f_flags & F_EXEC) != 0) + abfd->flags |= D_PAGED; bfd_get_symcount(abfd) = internal_f->f_nsyms; if (internal_f->f_nsyms) @@ -188,13 +190,13 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) return abfd->xvec; fail: bfd_release(abfd, tdata); - return (bfd_target *)NULL; + return (const bfd_target *)NULL; } /* Turn a COFF file into a BFD, but fail with bfd_error_wrong_format if it is not a COFF file. This is also used by ECOFF. */ -bfd_target * +const bfd_target * coff_object_p (abfd) bfd *abfd; { diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 43e2f30..a2ed76d 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -3490,7 +3490,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) /* See whether this BFD is an archive. If it is, read in the armap and the extended name table. */ -bfd_target * +const bfd_target * _bfd_ecoff_archive_p (abfd) bfd *abfd; { @@ -3501,7 +3501,7 @@ _bfd_ecoff_archive_p (abfd) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } /* We are setting bfd_ardata(abfd) here, but since bfd_ardata @@ -3513,7 +3513,7 @@ _bfd_ecoff_archive_p (abfd) if (bfd_ardata (abfd) == (struct artdata *) NULL) { bfd_set_error (bfd_error_no_memory); - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } bfd_ardata (abfd)->first_file_filepos = SARMAG; @@ -3528,7 +3528,7 @@ _bfd_ecoff_archive_p (abfd) { bfd_release (abfd, bfd_ardata (abfd)); abfd->tdata.aout_ar_data = (struct artdata *) NULL; - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } return abfd->xvec; diff --git a/bfd/elf32-target.h b/bfd/elf32-target.h index 6192ad5..707b007 100644 --- a/bfd/elf32-target.h +++ b/bfd/elf32-target.h @@ -178,7 +178,7 @@ static CONST struct elf_backend_data elf32_bed = }; #ifdef TARGET_BIG_SYM -bfd_target TARGET_BIG_SYM = +const bfd_target TARGET_BIG_SYM = { /* name: identify kind of target */ TARGET_BIG_NAME, @@ -266,7 +266,7 @@ bfd_target TARGET_BIG_SYM = #endif #ifdef TARGET_LITTLE_SYM -bfd_target TARGET_LITTLE_SYM = +const bfd_target TARGET_LITTLE_SYM = { /* name: identify kind of target */ TARGET_LITTLE_NAME, diff --git a/bfd/elf64-target.h b/bfd/elf64-target.h index dbab77d..0a87080 100644 --- a/bfd/elf64-target.h +++ b/bfd/elf64-target.h @@ -181,7 +181,7 @@ static CONST struct elf_backend_data elf64_bed = }; #ifdef TARGET_BIG_SYM -bfd_target TARGET_BIG_SYM = +const bfd_target TARGET_BIG_SYM = { /* name: identify kind of target */ TARGET_BIG_NAME, @@ -269,7 +269,7 @@ bfd_target TARGET_BIG_SYM = #endif #ifdef TARGET_LITTLE_SYM -bfd_target TARGET_LITTLE_SYM = +const bfd_target TARGET_LITTLE_SYM = { /* name: identify kind of target */ TARGET_LITTLE_NAME, diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 54d4bbd..c6fea5c 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -824,7 +824,7 @@ elf_file_p (x_ehdrp) any side effects in ABFD, or any data it points to (like tdata), if the file does not match the target vector. */ -bfd_target * +const bfd_target * elf_object_p (abfd) bfd *abfd; { @@ -907,7 +907,7 @@ elf_object_p (abfd) BFD format expects. */ if (ebd->elf_machine_code != i_ehdrp->e_machine) { - bfd_target **target_ptr; + const bfd_target * const *target_ptr; if (ebd->elf_machine_code != EM_NONE) goto got_wrong_format_error; @@ -3694,7 +3694,7 @@ elf_corefile_note (abfd, hdr) */ -bfd_target * +const bfd_target * elf_core_file_p (abfd) bfd *abfd; { @@ -3783,7 +3783,7 @@ elf_core_file_p (abfd) BFD format expects. */ if (ebd->elf_machine_code != i_ehdrp->e_machine) { - bfd_target **target_ptr; + const bfd_target * const *target_ptr; if (ebd->elf_machine_code != EM_NONE) goto wrong; diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index 3db7b14..7ed7c7e 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -88,7 +88,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ char *lynx_core_file_failing_command (); int lynx_core_file_failing_signal (); boolean lynx_core_file_matches_executable_p (); -bfd_target *lynx_core_file_p (); +const bfd_target *lynx_core_file_p (); #define MY_core_file_failing_command lynx_core_file_failing_command #define MY_core_file_failing_signal lynx_core_file_failing_signal @@ -107,7 +107,7 @@ extern reloc_howto_type aout_32_std_howto_table[]; /* Output standard relocation information to a file in target byte order. */ void -NAME (lynx, swap_std_reloc_out) (abfd, g, natptr) +NAME(lynx,swap_std_reloc_out) (abfd, g, natptr) bfd *abfd; arelent *g; struct reloc_std_external *natptr; @@ -203,7 +203,7 @@ NAME (lynx, swap_std_reloc_out) (abfd, g, natptr) /* Output extended relocation information to a file in target byte order. */ void -NAME (lynx, swap_ext_reloc_out) (abfd, g, natptr) +NAME(lynx,swap_ext_reloc_out) (abfd, g, natptr) bfd *abfd; arelent *g; register struct reloc_ext_external *natptr; @@ -321,7 +321,7 @@ NAME (lynx, swap_ext_reloc_out) (abfd, g, natptr) } \ void -NAME (lynx, swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) +NAME(lynx,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) bfd *abfd; struct reloc_ext_external *bytes; arelent *cache_ptr; @@ -344,7 +344,7 @@ NAME (lynx, swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) } void -NAME (lynx, swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols) +NAME(lynx,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols) bfd *abfd; struct reloc_std_external *bytes; arelent *cache_ptr; @@ -448,7 +448,7 @@ doit: for (; counter < count; counter++, rptr++, cache_ptr++) { - NAME (lynx, swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols); + NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols); } } else @@ -459,7 +459,7 @@ doit: for (; counter < count; counter++, rptr++, cache_ptr++) { - NAME (lynx, swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols); + NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols); } } @@ -475,7 +475,7 @@ doit: /* Write out a relocation section into an object file. */ boolean -NAME (lynx, squirt_out_relocs) (abfd, section) +NAME(lynx,squirt_out_relocs) (abfd, section) bfd *abfd; asection *section; { @@ -505,14 +505,14 @@ NAME (lynx, squirt_out_relocs) (abfd, section) for (natptr = native; count != 0; --count, natptr += each_size, ++generic) - NAME (lynx, swap_ext_reloc_out) (abfd, *generic, (struct reloc_ext_external *) natptr); + NAME(lynx,swap_ext_reloc_out) (abfd, *generic, (struct reloc_ext_external *) natptr); } else { for (natptr = native; count != 0; --count, natptr += each_size, ++generic) - NAME (lynx, swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr); + NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr); } if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize) @@ -801,7 +801,7 @@ Move from our internal lists to the canon table, and insert in symbol index order */ -extern bfd_target ieee_vec; +extern const bfd_target ieee_vec; long ieee_get_symtab (abfd, location) @@ -1052,7 +1052,7 @@ ieee_slurp_sections (abfd) * archive stuff */ -bfd_target * +const bfd_target * ieee_archive_p (abfd) bfd *abfd; { @@ -1085,7 +1085,7 @@ ieee_archive_p (abfd) if (this_byte (&(ieee->h)) != Module_Beginning) { abfd->tdata.ieee_ar_data = save; - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } next_byte (&(ieee->h)); @@ -1094,7 +1094,7 @@ ieee_archive_p (abfd) { bfd_release (abfd, ieee); abfd->tdata.ieee_ar_data = save; - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } /* Throw away the filename */ read_id (&(ieee->h)); @@ -1104,7 +1104,7 @@ ieee_archive_p (abfd) if (!obstack_begin (&ob, 128)) { bfd_set_error (bfd_error_no_memory); - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } ieee->element_count = 0; @@ -1152,7 +1152,7 @@ ieee_archive_p (abfd) if (!ieee->elements) { bfd_set_error (bfd_error_no_memory); - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } /* Now scan the area again, and replace BB offsets with file */ @@ -1194,7 +1194,7 @@ ieee_mkobject (abfd) return abfd->tdata.ieee_data ? true : false; } -bfd_target * +const bfd_target * ieee_object_p (abfd) bfd *abfd; { @@ -1217,7 +1217,7 @@ ieee_object_p (abfd) ieee->h.input_p = buffer; if (this_byte_and_next (&(ieee->h)) != Module_Beginning) - goto fail; + goto got_wrong_format; ieee->read_symbols = false; ieee->read_data = false; @@ -1231,7 +1231,7 @@ ieee_object_p (abfd) processor = ieee->mb.processor = read_id (&(ieee->h)); if (strcmp (processor, "LIBRARY") == 0) - goto fail; + goto got_wrong_format; ieee->mb.module_name = read_id (&(ieee->h)); if (abfd->filename == (CONST char *) NULL) { @@ -1242,7 +1242,7 @@ ieee_object_p (abfd) { bfd_arch_info_type *arch = bfd_scan_arch (processor); if (arch == 0) - goto fail; + goto got_wrong_format; abfd->arch_info = arch; } @@ -1306,10 +1306,12 @@ ieee_object_p (abfd) ieee_slurp_sections (abfd); return abfd->xvec; +got_wrong_format: + bfd_set_error (bfd_error_wrong_format); fail: (void) bfd_release (abfd, ieee); abfd->tdata.ieee_data = save; - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } void @@ -3369,7 +3371,7 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_final_link _bfd_generic_final_link /*SUPPRESS 460 */ -bfd_target ieee_vec = +const bfd_target ieee_vec = { "ieee", /* name */ bfd_target_ieee_flavour, diff --git a/bfd/libelf.h b/bfd/libelf.h index 2838a5e..cc6e4db 100644 --- a/bfd/libelf.h +++ b/bfd/libelf.h @@ -483,8 +483,8 @@ extern boolean _bfd_elf_link_hash_table_init extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *)); extern boolean bfd_elf64_write_object_contents PARAMS ((bfd *)); -extern bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); -extern bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); +extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); +extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *)); extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *, @@ -540,8 +540,8 @@ extern boolean bfd_elf32_add_dynamic_entry extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -extern bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); -extern bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); +extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); +extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *)); extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *)); extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *, diff --git a/bfd/m68klynx.c b/bfd/m68klynx.c index 0c7fce3..34d2d29 100644 --- a/bfd/m68klynx.c +++ b/bfd/m68klynx.c @@ -43,7 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ char *lynx_core_file_failing_command(); int lynx_core_file_failing_signal(); boolean lynx_core_file_matches_executable_p(); -bfd_target *lynx_core_file_p(); +const bfd_target *lynx_core_file_p(); #define MY_core_file_failing_command lynx_core_file_failing_command #define MY_core_file_failing_signal lynx_core_file_failing_signal diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 849c27e..55b0892 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -388,7 +388,7 @@ static CONST struct aout_backend_data MY(backend_data) = { 0 /* finish_dynamic_link */ }; -bfd_target aout_mips_little_vec = +const bfd_target aout_mips_little_vec = { "a.out-mips-little", /* name */ bfd_target_aout_flavour, @@ -428,7 +428,7 @@ bfd_target aout_mips_little_vec = (PTR) MY_backend_data, }; -bfd_target aout_mips_big_vec = +const bfd_target aout_mips_big_vec = { "a.out-mips-big", /* name */ bfd_target_aout_flavour, diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h index 4658a13..a53c67b 100644 --- a/bfd/nlmcode.h +++ b/bfd/nlmcode.h @@ -91,7 +91,7 @@ static int nlm_external_reloc_compare #define get_word bfd_h_get_32 #endif -bfd_target * +const bfd_target * nlm_object_p (abfd) bfd *abfd; { @@ -214,6 +214,9 @@ nlm_object_p (abfd) if (arch != bfd_arch_unknown) bfd_default_set_arch_mach (abfd, arch, (unsigned long) 0); + abfd->flags |= EXEC_P; + bfd_get_start_address (abfd) = nlm_fixed_header (abfd)->codeStartOffset; + return (abfd->xvec); got_wrong_format_error: diff --git a/bfd/oasys.c b/bfd/oasys.c index e0dfd29..6d85443 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1,5 +1,5 @@ /* BFD back-end for oasys objects. - Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -230,7 +230,7 @@ oasys_get_symtab_upper_bound (abfd) /* */ -extern bfd_target oasys_vec; +extern const bfd_target oasys_vec; long oasys_get_symtab (abfd, location) @@ -256,7 +256,7 @@ oasys_get_symtab (abfd, location) * archive stuff */ -static bfd_target * +static const bfd_target * oasys_archive_p (abfd) bfd *abfd; { @@ -293,7 +293,7 @@ oasys_archive_p (abfd) header.mod_count > 10000 || header.sym_count > 100000 || header.xref_count > 100000) - return (bfd_target *) NULL; + return (const bfd_target *) NULL; /* That all worked, let's buy the space for the header and read in @@ -407,7 +407,7 @@ oasys_mkobject (abfd) } #define MAX_SECS 16 -static bfd_target * +static const bfd_target * oasys_object_p (abfd) bfd *abfd; { @@ -522,7 +522,7 @@ oasys_object_p (abfd) fail: (void) bfd_release (abfd, oasys); abfd->tdata.oasys_obj_data = save; - return (bfd_target *) NULL; + return (const bfd_target *) NULL; } @@ -1497,7 +1497,7 @@ oasys_sizeof_headers (abfd, exec) #define oasys_bfd_final_link _bfd_generic_final_link /*SUPPRESS 460 */ -bfd_target oasys_vec = +const bfd_target oasys_vec = { "oasys", /* name */ bfd_target_oasys_flavour, @@ -1545,6 +1545,7 @@ bfd_target oasys_vec = BFD_JUMP_TABLE_RELOCS (oasys), BFD_JUMP_TABLE_WRITE (oasys), BFD_JUMP_TABLE_LINK (oasys), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), (PTR) 0 }; @@ -144,11 +144,11 @@ struct som_misc_symbol_info /* Forward declarations */ static boolean som_mkobject PARAMS ((bfd *)); -static bfd_target * som_object_setup PARAMS ((bfd *, - struct header *, - struct som_exec_auxhdr *)); +static const bfd_target * som_object_setup PARAMS ((bfd *, + struct header *, + struct som_exec_auxhdr *)); static boolean setup_sections PARAMS ((bfd *, struct header *)); -static bfd_target * som_object_p PARAMS ((bfd *)); +static const bfd_target * som_object_p PARAMS ((bfd *)); static boolean som_write_object_contents PARAMS ((bfd *)); static boolean som_slurp_string_table PARAMS ((bfd *)); static unsigned int som_slurp_symbol_table PARAMS ((bfd *)); @@ -1563,7 +1563,7 @@ som_bfd_reloc_type_lookup (abfd, code) /* Perform some initialization for an object. Save results of this initialization in the BFD. */ -static bfd_target * +static const bfd_target * som_object_setup (abfd, file_hdrp, aux_hdrp) bfd *abfd; struct header *file_hdrp; @@ -1861,7 +1861,7 @@ setup_sections (abfd, file_hdr) /* Read in a SOM object and make it into a BFD. */ -static bfd_target * +static const bfd_target * som_object_p (abfd) bfd *abfd; { @@ -4263,7 +4263,7 @@ som_canonicalize_reloc (abfd, section, relptr, symbols) return section->reloc_count; } -extern bfd_target som_vec; +extern const bfd_target som_vec; /* A hook to set up object file dependent section information. */ @@ -5535,7 +5535,7 @@ som_bfd_free_cached_info (abfd) #define som_bfd_link_add_symbols _bfd_generic_link_add_symbols #define som_bfd_final_link _bfd_generic_final_link -bfd_target som_vec = +const bfd_target som_vec = { "som", /* name */ bfd_target_som_flavour, @@ -468,7 +468,7 @@ pass_over (abfd, func, symbolfunc, section) } -static bfd_target * +static const bfd_target * object_p (abfd) bfd *abfd; { @@ -491,7 +491,7 @@ object_p (abfd) return abfd->xvec; } -static bfd_target * +static const bfd_target * srec_object_p (abfd) bfd *abfd; { @@ -504,7 +504,7 @@ srec_object_p (abfd) return NULL; if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) - return (bfd_target *) NULL; + return (const bfd_target *) NULL; /* We create one section called .text for all the contents, and allocate enough room for the entire file. */ @@ -513,7 +513,7 @@ srec_object_p (abfd) } -static bfd_target * +static const bfd_target * symbolsrec_object_p (abfd) bfd *abfd; { @@ -526,7 +526,7 @@ symbolsrec_object_p (abfd) return NULL; if (b[0] != '$' || b[1] != '$') - return (bfd_target *) NULL; + return (const bfd_target *) NULL; return object_p (abfd); } @@ -764,19 +764,19 @@ srec_write_symbols (abfd) char buffer[MAXCHUNK]; /* Dump out the symbols of a bfd */ int i; - int len = bfd_get_symcount (abfd); + int count = bfd_get_symcount (abfd); - if (len) + if (count) { size_t len; asymbol **table = bfd_get_outsymbols (abfd); sprintf (buffer, "$$ %s\r\n", abfd->filename); - len = strlen (buffer) + 1; + len = strlen (buffer); if (bfd_write (buffer, len, 1, abfd) != len) return false; - for (i = 0; i < len; i++) + for (i = 0; i < count; i++) { asymbol *s = table[i]; #if 0 @@ -818,7 +818,7 @@ srec_write_symbols (abfd) } } sprintf (buffer, "$$ \r\n"); - len = strlen (buffer) + 1; + len = strlen (buffer); if (bfd_write (buffer, len, 1, abfd) != len) return false; } @@ -962,7 +962,7 @@ srec_print_symbol (ignore_abfd, afile, symbol, how) #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols #define srec_bfd_final_link _bfd_generic_final_link -bfd_target srec_vec = +const bfd_target srec_vec = { "srec", /* name */ bfd_target_srec_flavour, @@ -987,8 +987,8 @@ bfd_target srec_vec = { _bfd_dummy_target, srec_object_p, /* bfd_check_format */ - (struct bfd_target * (*)()) bfd_nullvoidptr, - (struct bfd_target * (*)()) bfd_nullvoidptr, + _bfd_dummy_target, + _bfd_dummy_target, }, { bfd_false, @@ -1018,7 +1018,7 @@ bfd_target srec_vec = -bfd_target symbolsrec_vec = +const bfd_target symbolsrec_vec = { "symbolsrec", /* name */ bfd_target_srec_flavour, @@ -1043,8 +1043,8 @@ bfd_target symbolsrec_vec = { _bfd_dummy_target, symbolsrec_object_p, /* bfd_check_format */ - (struct bfd_target * (*)()) bfd_nullvoidptr, - (struct bfd_target * (*)()) bfd_nullvoidptr, + _bfd_dummy_target, + _bfd_dummy_target, }, { bfd_false, diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 4d8e19d..12ab48f 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -586,7 +586,7 @@ tekhex_mkobject (abfd) Return true if the file looks like it's in TekHex format. Just look for a percent sign and some hex digits */ -static bfd_target * +static const bfd_target * tekhex_object_p (abfd) bfd *abfd; { @@ -600,7 +600,7 @@ tekhex_object_p (abfd) return NULL; if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) - return (bfd_target *) NULL; + return (const bfd_target *) NULL; tekhex_mkobject (abfd); @@ -1015,7 +1015,7 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how) #define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols #define tekhex_bfd_final_link _bfd_generic_final_link -bfd_target tekhex_vec = +const bfd_target tekhex_vec = { "tekhex", /* name */ bfd_target_tekhex_flavour, @@ -1040,8 +1040,8 @@ bfd_target tekhex_vec = { _bfd_dummy_target, tekhex_object_p, /* bfd_check_format */ - (struct bfd_target * (*)()) bfd_nullvoidptr, - (struct bfd_target * (*)()) bfd_nullvoidptr, + _bfd_dummy_target, + _bfd_dummy_target, }, { bfd_false, |