diff options
author | Nick Clifton <nickc@redhat.com> | 2001-08-23 17:05:52 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2001-08-23 17:05:52 +0000 |
commit | f4ffd7781861852041371dd8faed724d64f1a96a (patch) | |
tree | b097bd2621892124024c71674c68d49880fa4d48 /bfd | |
parent | dc67663583f5a61819e68f968e20c0e19491fd75 (diff) | |
download | binutils-f4ffd7781861852041371dd8faed724d64f1a96a.tar.gz binutils-f4ffd7781861852041371dd8faed724d64f1a96a.tar.bz2 binutils-f4ffd7781861852041371dd8faed724d64f1a96a.zip |
Add more missing prototypes
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/coff-h8300.c | 39 | ||||
-rw-r--r-- | bfd/coff-h8500.c | 55 | ||||
-rw-r--r-- | bfd/coff-m68k.c | 35 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 577 | ||||
-rw-r--r-- | bfd/coff-sh.c | 9 | ||||
-rw-r--r-- | bfd/coff-tic30.c | 48 | ||||
-rw-r--r-- | bfd/coff-tic54x.c | 824 | ||||
-rw-r--r-- | bfd/coff-w65.c | 161 | ||||
-rw-r--r-- | bfd/coff-z8k.c | 14 |
10 files changed, 907 insertions, 864 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 583d82917cf..43e2e3dfbad 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -29,6 +29,15 @@ * libaout.h (N_SET_DYNAMIC): Silence compile time warning. * bout.c: Add missing function prototypes. Fix formatting. + * coff-z8k.c: Add missing function prototypes. Fix formatting. + * coff-w65.c: Add missing function prototypes. Fix formatting. + * coff-h8500.c: Add missing function prototypes. Fix formatting. + * coff-h8300.c: Add missing function prototypes. Fix formatting. + * coff-tic54x.c: Add missing function prototypes. Fix formatting. + * coff-tic30.c: Add missing function prototypes. Fix formatting. + * coff-m68k.c: Add missing function prototypes. Fix formatting. + * coff-rs6000.c: Add missing function prototypes. Fix formatting. + * coff-sh.c: Add missing function prototypes. Fix formatting. 2001-08-23 Jakub Jelinek <jakub@redhat.com> diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index cdbd79c8a46..1a4f1661010 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,6 +1,6 @@ /* BFD back-end for Hitachi H8/300 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain, <sac@cygnus.com>. @@ -38,25 +38,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ the offset where we'll add the next entry. */ struct funcvec_hash_entry -{ - /* The basic hash table entry. */ - struct bfd_hash_entry root; + { + /* The basic hash table entry. */ + struct bfd_hash_entry root; - /* The offset within the vectors section where - this entry lives. */ - bfd_vma offset; -}; + /* The offset within the vectors section where + this entry lives. */ + bfd_vma offset; + }; struct funcvec_hash_table -{ - /* The basic hash table. */ - struct bfd_hash_table root; + { + /* The basic hash table. */ + struct bfd_hash_table root; - bfd *abfd; + bfd *abfd; - /* Offset at which we'll add the next entry. */ - unsigned int offset; -}; + /* Offset at which we'll add the next entry. */ + unsigned int offset; + }; static struct bfd_hash_entry * funcvec_hash_newfunc @@ -69,6 +69,15 @@ funcvec_hash_table_init struct bfd_hash_table *, const char *)))); +static bfd_reloc_status_type special PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static int select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static boolean h8300_symbol_address_p PARAMS ((bfd *, asection *, bfd_vma)); +static int h8300_reloc16_estimate PARAMS ((bfd *, asection *, arelent *, unsigned int, struct bfd_link_info *)); +static void h8300_reloc16_extra_cases PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); +static boolean h8300_bfd_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); + /* To lookup a value in the function vector hash table. */ #define funcvec_hash_lookup(table, string, create, copy) \ ((struct funcvec_hash_entry *) \ diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index 326965467b7..ecbb70ff3f9 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi H8/500 COFF binaries. - Copyright 1993, 1994, 1995, 1997, 1999, 2000 + Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. @@ -28,6 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" +static int coff_h8500_select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) static reloc_howto_type r_imm8 = @@ -63,8 +68,8 @@ HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel static reloc_howto_type r_high16 = HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0, complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false); - -/* Turn a howto into a reloc number */ + +/* Turn a howto into a reloc number. */ static int coff_h8500_select_reloc (howto) @@ -80,18 +85,17 @@ coff_h8500_select_reloc (howto) #define __A_MAGIC_SET__ -/* Code to swap in the reloc */ +/* Code to swap in the reloc. */ #define SWAP_IN_RELOC_OFFSET bfd_h_get_32 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; -/* Code to turn a r_type into a howto ptr, uses the above howto table - */ +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void -rtype2howto(internal, dst) +rtype2howto (internal, dst) arelent * internal; struct internal_reloc *dst; { @@ -132,7 +136,7 @@ rtype2howto(internal, dst) #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessary magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; @@ -151,13 +155,9 @@ static void reloc_processing (relent, reloc, symbols, abfd, section) rtype2howto (relent, reloc); if (reloc->r_symndx > 0) - { - relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; - } + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; else - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - } + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; relent->addend = reloc->r_offset; relent->address -= section->vma; @@ -175,6 +175,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) { bfd_byte *d = data+*dst_ptr; asection *input_section = link_order->u.indirect.section; + switch (reloc->howto->type) { case R_H8500_IMM8: @@ -189,7 +190,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) bfd_put_8 (in_abfd, (bfd_coff_reloc16_get_value (reloc, link_info, input_section) >> 16), - d ); + d); (*dst_ptr) += 1; (*src_ptr) += 1; break; @@ -197,7 +198,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) case R_H8500_IMM16: bfd_put_16 (in_abfd, bfd_coff_reloc16_get_value (reloc, link_info, input_section), - d ); + d); (*dst_ptr) += 2; (*src_ptr) += 2; break; @@ -214,7 +215,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) case R_H8500_HIGH16: bfd_put_16 (in_abfd, (bfd_coff_reloc16_get_value (reloc, link_info, input_section) - >>16), + >> 16), d); (*dst_ptr) += 2; @@ -223,20 +224,20 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) case R_H8500_IMM24: { - int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section); + int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1); v = (v & 0x00ffffff) | (o & 0xff00000); bfd_put_32 (in_abfd, v, data + *dst_ptr -1); - (*dst_ptr) +=3; - (*src_ptr)+=3;; + (*dst_ptr) += 3; + (*src_ptr) += 3;; } break; case R_H8500_IMM32: { - int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section); + int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); bfd_put_32 (in_abfd, v, data + *dst_ptr); - (*dst_ptr) +=4; - (*src_ptr)+=4;; + (*dst_ptr) += 4; + (*src_ptr) += 4;; } break; @@ -248,7 +249,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) + *dst_ptr + link_order->u.indirect.section->output_section->vma; int gap = dst - dot - 1; /* -1 since were in the odd byte of the - word and the pc's been incremented */ + word and the pc's been incremented. */ if (gap > 128 || gap < -128) { @@ -271,7 +272,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) + *dst_ptr + link_order->u.indirect.section->output_section->vma; int gap = dst - dot - 1; /* -1 since were in the odd byte of the - word and the pc's been incremented */ + word and the pc's been incremented. */ if (gap > 32767 || gap < -32768) { @@ -282,8 +283,8 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) abort (); } bfd_put_16 (in_abfd, gap, data + *dst_ptr); - (*dst_ptr)+=2; - (*src_ptr)+=2; + (*dst_ptr) += 2; + (*src_ptr) += 2; break; } diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index 8adaf7fc075..abab6329255 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -68,18 +68,6 @@ static reloc_howto_type *m68kcoff_common_addend_rtype_to_howto #endif static boolean m68k_coff_is_local_label_name PARAMS ((bfd *, const char *)); -#ifdef STATIC_RELOCS -static -#endif -reloc_howto_type * m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); -#ifdef STATIC_RELOCS -static -#endif -int m68k_howto2rtype PARAMS ((reloc_howto_type *)); -#ifdef STATIC_RELOCS -static -#endif -void m68k_rtype2howto PARAMS ((arelent *, int)); /* On the delta, a symbol starting with L% is local. We won't see such a symbol on other platforms, so it should be safe to always @@ -135,10 +123,19 @@ extern int m68k_howto2rtype PARAMS ((reloc_howto_type *)); extern reloc_howto_type *m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); #else + #ifdef STATIC_RELOCS -static +#define STAT_REL static +#else +#define STAT_REL #endif -void + +STAT_REL reloc_howto_type * m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +STAT_REL int m68k_howto2rtype PARAMS ((reloc_howto_type *)); +STAT_REL void m68k_rtype2howto PARAMS ((arelent *, int)); + + +STAT_REL void m68k_rtype2howto(internal, relocentry) arelent *internal; int relocentry; @@ -155,10 +152,7 @@ m68k_rtype2howto(internal, relocentry) } } -#ifdef STATIC_RELOCS -static -#endif -int +STAT_REL int m68k_howto2rtype (internal) reloc_howto_type *internal; { @@ -183,10 +177,7 @@ m68k_howto2rtype (internal) return R_RELLONG; } -#ifdef STATIC_RELOCS -static -#endif -reloc_howto_type * +STAT_REL reloc_howto_type * m68k_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code; diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 645e47e4bee..bfe37654e20 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -56,10 +56,10 @@ extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -/* Forward declare _bfd_xcoff_rtype2howto for coffcode.h macro */ +/* Forward declare _bfd_xcoff_rtype2howto for coffcode.h macro. */ void _bfd_xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); -/* coffcode.h needs these to be defined */ +/* coffcode.h needs these to be defined. */ #define RS6000COFF_C 1 #define SELECT_RELOC(internal, howto) \ @@ -249,21 +249,24 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1) PTR in1; { SYMENT *ext = (SYMENT *)ext1; - struct internal_syment *in = (struct internal_syment *)in1; + struct internal_syment * in = (struct internal_syment *)in1; - if(ext->e.e_name[0] != 0) { - memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); - } else { - in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset); - } + if (ext->e.e_name[0] != 0) + { + memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); + } + else + { + in->_n._n_n._n_zeroes = 0; + in->_n._n_n._n_offset = + bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset); + } - in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); - in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); - in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); + in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value); + in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum); + in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type); + in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass); + in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux); } unsigned int @@ -275,19 +278,22 @@ _bfd_xcoff_swap_sym_out (abfd, inp, extp) struct internal_syment *in = (struct internal_syment *)inp; SYMENT *ext =(SYMENT *)extp; - if(in->_n._n_name[0] != 0) { - memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); - } else { - bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32(abfd, in->_n._n_n._n_offset, - (bfd_byte *) ext->e.e.e_offset); - } + if (in->_n._n_name[0] != 0) + { + memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); + } + else + { + bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); + bfd_h_put_32 (abfd, in->_n._n_n._n_offset, + (bfd_byte *) ext->e.e.e_offset); + } - bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); - bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); - bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); + bfd_h_put_32 (abfd, in->n_value , (bfd_byte *) ext->e_value); + bfd_h_put_16 (abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); + bfd_h_put_16 (abfd, in->n_type , (bfd_byte *) ext->e_type); + bfd_h_put_8 (abfd, in->n_sclass , ext->e_sclass); + bfd_h_put_8 (abfd, in->n_numaux , ext->e_numaux); return bfd_coff_symesz (abfd); } @@ -308,27 +314,31 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) int numaux; PTR in1; { - AUXENT *ext = (AUXENT *)ext1; + AUXENT * ext = (AUXENT *)ext1; union internal_auxent *in = (union internal_auxent *)in1; - switch (class) { + switch (class) + { case C_FILE: - if (ext->x_file.x_fname[0] == 0) { + if (ext->x_file.x_fname[0] == 0) + { in->x_file.x_n.x_zeroes = 0; in->x_file.x_n.x_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); - } else { - if (numaux > 1) - { - if (indx == 0) - memcpy (in->x_file.x_fname, ext->x_file.x_fname, - numaux * sizeof (AUXENT)); - } - else - { - memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); - } - } + bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset); + } + else + { + if (numaux > 1) + { + if (indx == 0) + memcpy (in->x_file.x_fname, ext->x_file.x_fname, + numaux * sizeof (AUXENT)); + } + else + { + memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); + } + } goto end; /* RS/6000 "csect" auxents */ @@ -355,7 +365,8 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) case C_STAT: case C_LEAFSTAT: case C_HIDDEN: - if (type == T_NULL) { + if (type == T_NULL) + { in->x_scn.x_scnlen = bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen); in->x_scn.x_nreloc = bfd_h_get_16(abfd, @@ -394,20 +405,22 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) in->x_sym.x_fcnary.x_ary.x_dimen[3] = bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } - if (ISFCN(type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); - } - else { - in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16(abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_lnno); - in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_size); - } -end: ; - /* the semicolon is because MSVC doesn't like labels at - end of block. */ + if (ISFCN (type)) + { + in->x_sym.x_misc.x_fsize = bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); + } + else + { + in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16 (abfd, (bfd_byte *) + ext->x_sym.x_misc.x_lnsz.x_lnno); + in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16 (abfd, (bfd_byte *) + ext->x_sym.x_misc.x_lnsz.x_size); + } + end: ; + /* The semicolon is because MSVC doesn't like labels at + end of block. */ } @@ -428,60 +441,61 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) memset((PTR)ext, 0, bfd_coff_auxesz (abfd)); switch (class) { - case C_FILE: - if (in->x_file.x_fname[0] == 0) - { - PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - PUTWORD(abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); - } - else - { - memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); - } - goto end; - - /* RS/6000 "csect" auxents */ - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - PUTWORD (abfd, in->x_csect.x_scnlen.l,ext->x_csect.x_scnlen); - PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); - PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); - PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); - PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); - PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); - goto end; - } - break; - - case C_STAT: - case C_LEAFSTAT: - case C_HIDDEN: - if (type == T_NULL) { - bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen); - bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc); - bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno); + case C_FILE: + if (in->x_file.x_fname[0] == 0) + { + PUTWORD (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); + PUTWORD (abfd, + in->x_file.x_n.x_offset, + (bfd_byte *) ext->x_file.x_n.x_offset); + } + else + { + memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); + } goto end; + + /* RS/6000 "csect" auxents */ + case C_EXT: + case C_HIDEXT: + if (indx + 1 == numaux) + { + PUTWORD (abfd, in->x_csect.x_scnlen.l,ext->x_csect.x_scnlen); + PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); + PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); + /* We don't have to hack bitfields in x_smtyp because it's + defined by shifts-and-ands, which are equivalent on all + byte orders. */ + PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); + PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); + PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); + PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); + goto end; + } + break; + + case C_STAT: + case C_LEAFSTAT: + case C_HIDDEN: + if (type == T_NULL) + { + bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen); + bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc); + bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno); + goto end; + } + break; } - break; - } - PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); + PUTWORD (abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); + bfd_h_put_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, + (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + PUTWORD (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); } else { @@ -500,10 +514,10 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) (bfd_byte *) ext->x_sym.x_misc.x_fsize); else { - bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno); - bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size); + bfd_h_put_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, + (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno); + bfd_h_put_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size, + (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size); } end: @@ -1527,6 +1541,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) } /* Write a single armap in the big format. */ + static boolean xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, prevoff, nextoff) @@ -1544,7 +1559,7 @@ xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, unsigned char buf[4]; bfd *sub; file_ptr fileoff; - const bfd_arch_info_type *arch_info; + const bfd_arch_info_type *arch_info = NULL; bfd *object_bfd; unsigned int i; @@ -1553,13 +1568,16 @@ xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, machines) since the fields's width is 20 and there numbers with more than 32 bits can be represented. */ sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx)); - if (bits64) { - sprintf (hdr.nextoff, "%d", 0); - } else { - /* do explict cast to long to remove compiler warning */ - sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10) - + (long) (4 + orl_ccount * 4 + stridx))); - } + if (bits64) + { + sprintf (hdr.nextoff, "%d", 0); + } + else + { + /* Do explict cast to long to remove compiler warning. */ + sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10) + + (long) (4 + orl_ccount * 4 + stridx))); + } memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff)); sprintf (hdr.date, "%d", 0); @@ -1642,7 +1660,6 @@ xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, return true; } -/*ARGSUSED*/ static boolean xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd *abfd; @@ -1654,7 +1671,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) unsigned int i; unsigned int orl_count_32, orl_count_64; unsigned int stridx_32, stridx_64; - const bfd_arch_info_type *arch_info; + const bfd_arch_info_type *arch_info = NULL; bfd *object_bfd; /* First, we look through the symbols and work out which are @@ -1685,7 +1702,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } /* A quick sanity check... */ BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count); - /* explicit cast to int for compiler */ + /* Explicit cast to int for compiler. */ BFD_ASSERT ((int)(stridx_64 + stridx_32) == stridx); /* Now write out each map. */ @@ -1703,7 +1720,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) return true; } -/*ARGSUSED*/ boolean _bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx) bfd *abfd; @@ -2247,7 +2263,6 @@ _bfd_xcoff_write_archive_contents (abfd) /* We can't use the usual coff_sizeof_headers routine, because AIX always uses an a.out header. */ -/*ARGSUSED*/ int _bfd_xcoff_sizeof_headers (abfd, reloc) bfd *abfd; @@ -2490,17 +2505,17 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, if this reloc is against the TOC anchor. */ if (sec->name[3] == '0' - && strcmp (sec->name, ".tc0") == 0) { - - val = xcoff_data (output_bfd)->toc; - } else { - - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value - - sec->vma); - } - + && strcmp (sec->name, ".tc0") == 0) + { + val = xcoff_data (output_bfd)->toc; + } + else + { + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } } } else @@ -2735,7 +2750,6 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, name = h->root.root.string; else { - name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); if (name == NULL) @@ -2804,23 +2818,26 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name) static boolean _bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, struct internal_syment *sym, - const char *name) { - - if (strlen (name) <= SYMNMLEN) { - strncpy (sym->_n._n_name, name, SYMNMLEN); - } else { - boolean hash; - bfd_size_type indx; - - hash = true; - if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; - indx = _bfd_stringtab_add (strtab, name, hash, false); - if (indx == (bfd_size_type) -1) - return false; - sym->_n._n_n._n_zeroes = 0; - sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx; - } + const char *name) +{ + if (strlen (name) <= SYMNMLEN) + { + strncpy (sym->_n._n_name, name, SYMNMLEN); + } + else + { + boolean hash; + bfd_size_type indx; + + hash = true; + if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) + hash = false; + indx = _bfd_stringtab_add (strtab, name, hash, false); + if (indx == (bfd_size_type) -1) + return false; + sym->_n._n_n._n_zeroes = 0; + sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx; + } return true; } @@ -2830,32 +2847,30 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name) union internal_auxent *aux; const char *symbol_name; { - asection *return_value = NULL; - /* - * .sv64 = x_smclas == 17 - * This is an invalid csect for 32 bit apps. - */ - static const char *names[19] = { + /* .sv64 = x_smclas == 17 + This is an invalid csect for 32 bit apps. */ + static const char *names[19] = + { ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo", ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0", ".td", NULL, ".sv3264" }; if ((19 >= aux->x_csect.x_smclas) && - (NULL != names[aux->x_csect.x_smclas])) { - - return_value = bfd_make_section_anyway - (abfd, names[aux->x_csect.x_smclas]); - - - } else { - (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_get_filename (abfd), symbol_name, aux->x_csect.x_smclas); - bfd_set_error (bfd_error_bad_value); - } + (NULL != names[aux->x_csect.x_smclas])) + { + return_value = bfd_make_section_anyway + (abfd, names[aux->x_csect.x_smclas]); + } + else + { + (*_bfd_error_handler) + (_("%s: symbol `%s' has unrecognized smclas %d"), + bfd_get_filename (abfd), symbol_name, aux->x_csect.x_smclas); + bfd_set_error (bfd_error_bad_value); + } return return_value; } @@ -2865,9 +2880,9 @@ xcoff_is_lineno_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; { - if (0xffff <= value) { + if (0xffff <= value) return true; - } + return false; } @@ -2876,16 +2891,16 @@ xcoff_is_reloc_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; { - if (0xffff <= value) { + if (0xffff <= value) return true; - } + return false; } static bfd_vma xcoff_loader_symbol_offset (abfd, ldhdr) bfd *abfd; - struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED; + struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED; { return bfd_xcoff_ldhdrsz(abfd); } @@ -2893,7 +2908,7 @@ xcoff_loader_symbol_offset (abfd, ldhdr) static bfd_vma xcoff_loader_reloc_offset (abfd, ldhdr) bfd *abfd; - struct internal_ldhdr *ldhdr; + struct internal_ldhdr *ldhdr; { return bfd_xcoff_ldhdrsz(abfd) + (ldhdr->l_nsyms * bfd_xcoff_ldsymsz(abfd)); @@ -2915,121 +2930,117 @@ HOWTO (0, /* type */ 0xffffffff, /* dst_mask */ false); /* pcrel_offset */ -/* - * glink - * - * The first word of global linkage code must be modified by filling in - * the correct TOC offset. - */ +/* glink + + The first word of global linkage code must be modified by filling in + the correct TOC offset. */ + static unsigned long xcoff_glink_code[9] = -{ - 0x81820000, /* lwz r12,0(r2) */ - 0x90410014, /* stw r2,20(r1) */ - 0x800c0000, /* lwz r0,0(r12) */ - 0x804c0004, /* lwz r2,4(r12) */ - 0x7c0903a6, /* mtctr r0 */ - 0x4e800420, /* bctr */ - 0x00000000, /* start of traceback table */ - 0x000c8000, /* traceback table */ - 0x00000000, /* traceback table */ -}; + { + 0x81820000, /* lwz r12,0(r2) */ + 0x90410014, /* stw r2,20(r1) */ + 0x800c0000, /* lwz r0,0(r12) */ + 0x804c0004, /* lwz r2,4(r12) */ + 0x7c0903a6, /* mtctr r0 */ + 0x4e800420, /* bctr */ + 0x00000000, /* start of traceback table */ + 0x000c8000, /* traceback table */ + 0x00000000, /* traceback table */ + }; static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = -{ - { /* COFF backend, defined in libcoff.h */ - _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */ - _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ - coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ - _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ - _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ - coff_swap_lineno_out, /* _bfd_swap_lineno_out */ - coff_swap_reloc_out, /* _bfd_swap_reloc_out */ - coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ - coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ - coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ - FILHSZ, /* _bfd_filhsz */ - AOUTSZ, /* _bfd_aoutsz */ - SCNHSZ, /* _bfd_scnhsz */ - SYMESZ, /* _bfd_symesz */ - AUXESZ, /* _bfd_auxesz */ - RELSZ, /* _bfd_relsz */ - LINESZ, /* _bfd_linesz */ - FILNMLEN, /* _bfd_filnmlen */ - true, /* _bfd_coff_long_filenames */ - false, /* _bfd_coff_long_section_names */ - (3), /* _bfd_coff_default_section_alignment_power */ - false, /* _bfd_coff_force_symnames_in_strings */ - 2, /* _bfd_coff_debug_string_prefix_length */ - coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ - coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ - coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ - coff_swap_reloc_in, /* _bfd_reloc_in */ - coff_bad_format_hook, /* _bfd_bad_format_hook */ - coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ - coff_mkobject_hook, /* _bfd_mkobject_hook */ - styp_to_sec_flags, /* _bfd_syp_to_sec_flags */ - coff_set_alignment_hook, /* _bfd_set_alignment_hook */ - coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ - symname_in_debug_hook, /* _coff_symname_in_debug_hook */ - coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */ - coff_print_aux, /* bfd_coff_print_aux */ - dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */ - dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */ - NULL, /* bfd_coff_sym_is_global */ - /* _bfd_coff_compute_section_file_positions */ - coff_compute_section_file_positions, - NULL , /* _bfd_coff_start_final_link */ - xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */ - coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ - NULL , /* _bfd_coff_addust_symndx */ - _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ - coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */ - coff_final_link_postscript /* _bfd_coff_final_link_postscript */ - }, - - 0x01DF, /* magic number */ - bfd_arch_rs6000, /* architecture */ - bfd_mach_rs6k, /* machine */ - - - /* function pointers to xcoff specific swap routines */ - xcoff_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */ - xcoff_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */ - xcoff_swap_ldsym_in, /* _xcoff_swap_ldsym_in */ - xcoff_swap_ldsym_out, /* _xcoff_swap_ldsym_out */ - xcoff_swap_ldrel_in, /* _xcoff_swap_ldrel_in */ - xcoff_swap_ldrel_out, /* _xcoff_swap_ldrel_out */ - - /* sizes */ - LDHDRSZ, /* _xcoff_ldhdrsz */ - LDSYMSZ, /* _xcoff_ldsymsz */ - LDRELSZ, /* _xcoff_ldrelsz */ - 12, /* _xcoff_function_descriptor_size */ - SMALL_AOUTSZ, /* _xcoff_small_aout_header_size */ - - /* versions */ - 1, /* _xcoff_ldhdr_version */ - - /* xcoff vs xcoff64 putting symbol names */ - _bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */ - _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ - - &xcoff_dynamic_reloc, /* dynamic reloc howto */ - - xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */ - - /* lineno and reloc count overflow */ - xcoff_is_lineno_count_overflow, - xcoff_is_reloc_count_overflow, - - xcoff_loader_symbol_offset, - xcoff_loader_reloc_offset, - - /* glink */ - &xcoff_glink_code[0], - (36), /* _xcoff_glink_size */ + { + { /* COFF backend, defined in libcoff.h. */ + _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */ + _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ + coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ + _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ + _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ + coff_swap_lineno_out, /* _bfd_swap_lineno_out */ + coff_swap_reloc_out, /* _bfd_swap_reloc_out */ + coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ + coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ + coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ + FILHSZ, /* _bfd_filhsz */ + AOUTSZ, /* _bfd_aoutsz */ + SCNHSZ, /* _bfd_scnhsz */ + SYMESZ, /* _bfd_symesz */ + AUXESZ, /* _bfd_auxesz */ + RELSZ, /* _bfd_relsz */ + LINESZ, /* _bfd_linesz */ + FILNMLEN, /* _bfd_filnmlen */ + true, /* _bfd_coff_long_filenames */ + false, /* _bfd_coff_long_section_names */ + (3), /* _bfd_coff_default_section_alignment_power */ + false, /* _bfd_coff_force_symnames_in_strings */ + 2, /* _bfd_coff_debug_string_prefix_length */ + coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ + coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ + coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ + coff_swap_reloc_in, /* _bfd_reloc_in */ + coff_bad_format_hook, /* _bfd_bad_format_hook */ + coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ + coff_mkobject_hook, /* _bfd_mkobject_hook */ + styp_to_sec_flags, /* _bfd_syp_to_sec_flags */ + coff_set_alignment_hook, /* _bfd_set_alignment_hook */ + coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ + symname_in_debug_hook, /* _coff_symname_in_debug_hook */ + coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */ + coff_print_aux, /* bfd_coff_print_aux */ + dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */ + dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */ + NULL, /* bfd_coff_sym_is_global */ + coff_compute_section_file_positions, /* _bfd_coff_compute_section_file_positions */ + NULL , /* _bfd_coff_start_final_link */ + xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */ + coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ + NULL , /* _bfd_coff_addust_symndx */ + _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ + coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */ + coff_final_link_postscript /* _bfd_coff_final_link_postscript */ + }, + + 0x01DF, /* magic number */ + bfd_arch_rs6000, /* architecture */ + bfd_mach_rs6k, /* machine */ + /* Function pointers to xcoff specific swap routines. */ + xcoff_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */ + xcoff_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */ + xcoff_swap_ldsym_in, /* _xcoff_swap_ldsym_in */ + xcoff_swap_ldsym_out, /* _xcoff_swap_ldsym_out */ + xcoff_swap_ldrel_in, /* _xcoff_swap_ldrel_in */ + xcoff_swap_ldrel_out, /* _xcoff_swap_ldrel_out */ + + /* Sizes. */ + LDHDRSZ, /* _xcoff_ldhdrsz */ + LDSYMSZ, /* _xcoff_ldsymsz */ + LDRELSZ, /* _xcoff_ldrelsz */ + 12, /* _xcoff_function_descriptor_size */ + SMALL_AOUTSZ, /* _xcoff_small_aout_header_size */ + + /* Versions. */ + 1, /* _xcoff_ldhdr_version */ + + /* Xcoff vs xcoff64 putting symbol names. */ + _bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */ + _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ + + & xcoff_dynamic_reloc, /* dynamic reloc howto */ + + xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */ + + /* Lineno and reloc count overflow. */ + xcoff_is_lineno_count_overflow, + xcoff_is_reloc_count_overflow, + + xcoff_loader_symbol_offset, + xcoff_loader_reloc_offset, + + /* glink. */ + & xcoff_glink_code[0], + (36), /* _xcoff_glink_size */ }; /* The transfer vector that leads the outside world to all of the above. */ diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 3f41a2d8ee6..f3b74e91fba 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. @@ -65,6 +65,7 @@ static boolean sh_relocate_section static bfd_byte *sh_coff_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, boolean, asymbol **)); +static reloc_howto_type * sh_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); #ifdef COFF_WITH_PE /* Can't build import tables with 2**4 alignment. */ @@ -83,6 +84,7 @@ static bfd_byte *sh_coff_get_relocated_section_contents #define COFF_LONG_FILENAMES #ifdef COFF_WITH_PE +static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); /* Return true if this relocation should appear in the output .reloc section. */ static boolean in_reloc_p (abfd, howto) @@ -412,6 +414,7 @@ get_symbol_value (symbol) /* Convert an rtype to howto for the COFF backend linker. Copied from coff-i386. */ #define coff_rtype_to_howto coff_sh_rtype_to_howto +static reloc_howto_type * coff_sh_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); static reloc_howto_type * coff_sh_rtype_to_howto (abfd, sec, rel, h, sym, addendp) @@ -2074,6 +2077,7 @@ static const struct sh_minor_opcode sh_opcodef[] = { MAP (sh_opcodef1), 0xf0ff } }; +#ifndef COFF_IMAGE_WITH_PE static struct sh_major_opcode sh_opcodes[] = { { MAP (sh_opcode0) }, @@ -2093,6 +2097,7 @@ static struct sh_major_opcode sh_opcodes[] = { MAP (sh_opcodee) }, { MAP (sh_opcodef) } }; +#endif /* The double data transfer / parallel processing insns are not described here. This will cause sh_align_load_span to leave them alone. */ @@ -3133,6 +3138,8 @@ CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE, #endif #ifndef TARGET_SHL_SYM +static const bfd_target * coff_small_object_p PARAMS ((bfd *)); +static boolean coff_small_new_section_hook PARAMS ((bfd *, asection *)); /* Some people want versions of the SH COFF target which do not align to 16 byte boundaries. We implement that by adding a couple of new target vectors. These are just like the ones above, but they diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c index 5b8ffd4625f..67b22755417 100644 --- a/bfd/coff-tic30.c +++ b/bfd/coff-tic30.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C30 coff binaries. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of BFD, the Binary File Descriptor library. @@ -27,22 +27,28 @@ #include "coff/internal.h" #include "libcoff.h" +static int coff_tic30_select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); + +reloc_howto_type * tic30_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) reloc_howto_type tic30_coff_howto_table[] = -{ - HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL, - "16", false, 0x0000FFFF, 0x0000FFFF, false), - HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL, - "24", false, 0xFFFFFF00, 0xFFFFFF00, false), - HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL, - "LDP", false, 0x00FF0000, 0x000000FF, false), - HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL, - "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false), - HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL, - "PCREL", false, 0x0000FFFF, 0x0000FFFF, false), - EMPTY_HOWTO (-1) -}; + { + HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL, + "16", false, 0x0000FFFF, 0x0000FFFF, false), + HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL, + "24", false, 0xFFFFFF00, 0xFFFFFF00, false), + HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL, + "LDP", false, 0x00FF0000, 0x000000FF, false), + HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL, + "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false), + HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL, + "PCREL", false, 0x0000FFFF, 0x0000FFFF, false), + EMPTY_HOWTO (-1) + }; #ifndef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup @@ -50,6 +56,7 @@ reloc_howto_type tic30_coff_howto_table[] = /* For the case statement use the code values used in tc_gen_reloc to map to the howto table entries that match those in both the aout and coff implementations. */ + reloc_howto_type * tic30_coff_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; @@ -75,7 +82,7 @@ tic30_coff_reloc_type_lookup (abfd, code) #endif -/* Turn a howto into a reloc number */ +/* Turn a howto into a reloc number. */ static int coff_tic30_select_reloc (howto) @@ -126,7 +133,7 @@ rtype2howto (internal, dst) } } -#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) +#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry) /* Perform any necessary magic to the addend in a reloc entry */ @@ -148,13 +155,10 @@ reloc_processing (relent, reloc, symbols, abfd, section) rtype2howto (relent, reloc); if (reloc->r_symndx > 0) - { - relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; - } + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; else - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - } + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + relent->addend = reloc->r_offset; relent->address -= section->vma; } diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 1e844ced19f..ed34d95ab3d 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C54X coff binaries. - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of BFD, the Binary File Descriptor library. @@ -27,23 +27,37 @@ #include "coff/internal.h" #include "libcoff.h" -#undef F_LSYMS +#undef F_LSYMS #define F_LSYMS F_LSYMS_TICOFF -/* - 32-bit operations - The octet order is screwy. words are LSB first (LS octet, actually), but - longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the - first word and 0x1234 in the second. When looking at the data as stored in - the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12. - Don't bother with 64-bits, as there aren't any. - */ +static void tic54x_reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static bfd_reloc_status_type tic54x_relocation PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static boolean tic54x_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +static reloc_howto_type * coff_tic54x_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); +static bfd_vma tic54x_getl32 PARAMS ((const bfd_byte *)); +static void tic54x_putl32 PARAMS ((bfd_vma, bfd_byte *)); +static bfd_signed_vma tic54x_getl_signed_32 PARAMS ((const bfd_byte *)); +static boolean tic54x_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static reloc_howto_type * tic54x_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void tic54x_lookup_howto PARAMS ((arelent *, struct internal_reloc *)); +static boolean ticoff0_bad_format_hook PARAMS ((bfd *, PTR)); +static boolean ticoff1_bad_format_hook PARAMS ((bfd *, PTR)); +static boolean ticoff_bfd_is_local_label_name PARAMS ((bfd *, const char *)); + +/* 32-bit operations + The octet order is screwy. words are LSB first (LS octet, actually), but + longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the + first word and 0x1234 in the second. When looking at the data as stored in + the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12. + Don't bother with 64-bits, as there aren't any. */ + static bfd_vma -tic54x_getl32(addr) - register const bfd_byte *addr; +tic54x_getl32 (addr) + const bfd_byte *addr; { unsigned long v; - v = (unsigned long) addr[2]; + + v = (unsigned long) addr[2]; v |= (unsigned long) addr[3] << 8; v |= (unsigned long) addr[0] << 16; v |= (unsigned long) addr[1] << 24; @@ -53,7 +67,7 @@ tic54x_getl32(addr) static void tic54x_putl32 (data, addr) bfd_vma data; - register bfd_byte *addr; + bfd_byte *addr; { addr[2] = (bfd_byte)data; addr[3] = (bfd_byte) (data >> 8); @@ -67,7 +81,7 @@ tic54x_getl_signed_32 (addr) { unsigned long v; - v = (unsigned long) addr[2]; + v = (unsigned long) addr[2]; v |= (unsigned long) addr[3] << 8; v |= (unsigned long) addr[0] << 16; v |= (unsigned long) addr[1] << 24; @@ -110,6 +124,7 @@ bfd_ticoff_get_section_load_page (sect) /* Set the architecture appropriately. Allow unkown architectures (e.g. binary). */ + static boolean tic54x_set_arch_mach (abfd, arch, machine) bfd *abfd; @@ -136,7 +151,6 @@ tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; { - if (output_bfd != (bfd *) NULL) { /* This is a partial relocation, and we want to apply the @@ -149,73 +163,73 @@ tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, } reloc_howto_type tic54x_howto_table[] = -{ -/* type,rightshift,size (0=byte, 1=short, 2=long), - bit size, pc_relative, bitpos, dont complain_on_overflow, - special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset */ - - /* NORMAL BANK */ - /* 16-bit direct reference to symbol's address */ - HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, - tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false), - - /* 7 LSBs of an address */ - HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont, - tic54x_relocation,"LS7",false,0x007F,0x007F,false), - - /* 9 MSBs of an address */ - /* TI assembler doesn't shift its encoding, and is thus incompatible */ - HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont, - tic54x_relocation,"MS9",false,0x01FF,0x01FF,false), - - /* 23-bit relocation */ - HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont, - tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false), - - /* 16 bits of 23-bit extended address */ - HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont, - tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false), - - /* upper 7 bits of 23-bit extended address */ - HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont, - tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false), - - /* ABSOLUTE BANK */ - /* 16-bit direct reference to symbol's address, absolute */ - HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, - tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false), - - /* 7 LSBs of an address, absolute */ - HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont, - tic54x_relocation,"ALS7",false,0x007F,0x007F,false), - - /* 9 MSBs of an address, absolute */ - /* TI assembler doesn't shift its encoding, and is thus incompatible */ - HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont, - tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false), - - /* 23-bit direct reference, absolute */ - HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont, - tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false), - - /* 16 bits of 23-bit extended address, absolute */ - HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont, - tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false), - - /* upper 7 bits of 23-bit extended address, absolute */ - HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont, - tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false), - - /* 32-bit relocation exclusively for stabs */ - HOWTO (R_RELLONG,0,2,32,false,0,complain_overflow_dont, - tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false), - -}; + { + /* type,rightshift,size (0=byte, 1=short, 2=long), + bit size, pc_relative, bitpos, dont complain_on_overflow, + special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */ + + /* NORMAL BANK */ + /* 16-bit direct reference to symbol's address. */ + HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, + tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false), + + /* 7 LSBs of an address */ + HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont, + tic54x_relocation,"LS7",false,0x007F,0x007F,false), + + /* 9 MSBs of an address */ + /* TI assembler doesn't shift its encoding, and is thus incompatible */ + HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont, + tic54x_relocation,"MS9",false,0x01FF,0x01FF,false), + + /* 23-bit relocation */ + HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont, + tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false), + + /* 16 bits of 23-bit extended address */ + HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont, + tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false), + + /* upper 7 bits of 23-bit extended address */ + HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont, + tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false), + + /* ABSOLUTE BANK */ + /* 16-bit direct reference to symbol's address, absolute */ + HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, + tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false), + + /* 7 LSBs of an address, absolute */ + HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont, + tic54x_relocation,"ALS7",false,0x007F,0x007F,false), + + /* 9 MSBs of an address, absolute */ + /* TI assembler doesn't shift its encoding, and is thus incompatible */ + HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont, + tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false), + + /* 23-bit direct reference, absolute */ + HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont, + tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false), + + /* 16 bits of 23-bit extended address, absolute */ + HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont, + tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false), + + /* upper 7 bits of 23-bit extended address, absolute */ + HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont, + tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false), + + /* 32-bit relocation exclusively for stabs */ + HOWTO (R_RELLONG,0,2,32,false,0,complain_overflow_dont, + tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false), + }; #define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup /* For the case statement use the code values used tc_gen_reloc (defined in - bfd/reloc.c) to map to the howto table entries */ + bfd/reloc.c) to map to the howto table entries. */ + reloc_howto_type * tic54x_coff_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; @@ -243,7 +257,8 @@ tic54x_coff_reloc_type_lookup (abfd, code) } /* Code to turn a r_type into a howto ptr, uses the above howto table. - Called after some initial checking by the tic54x_rtype_to_howto fn below */ + Called after some initial checking by the tic54x_rtype_to_howto fn below. */ + static void tic54x_lookup_howto (internal, dst) arelent *internal; @@ -251,6 +266,7 @@ tic54x_lookup_howto (internal, dst) { unsigned i; int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0; + for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++) { if (tic54x_howto_table[i].type == dst->r_type) @@ -268,8 +284,6 @@ tic54x_lookup_howto (internal, dst) #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT) -static void tic54x_reloc_processing(); - #define coff_rtype_to_howto coff_tic54x_rtype_to_howto static reloc_howto_type * @@ -322,8 +336,9 @@ ticoff1_bad_format_hook (abfd, filehdr) return true; } -/* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local - labels */ +/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local + labels. */ + static boolean ticoff_bfd_is_local_label_name (abfd, name) bfd *abfd ATTRIBUTE_UNUSED; @@ -339,8 +354,7 @@ ticoff_bfd_is_local_label_name (abfd, name) /* Customize coffcode.h; the default coff_ functions are set up to use COFF2; coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 and COFF0 vectors use custom _bad_format_hook procs instead of setting - BADMAG. - */ + BADMAG. */ #define BADMAG(x) COFF2_BADMAG(x) #include "coffcode.h" @@ -396,365 +410,365 @@ tic54x_reloc_processing (relent, reloc, symbols, abfd, section) refering to the symbols in the raw data have not been modified, so we have to have a negative addend to compensate. - Note that symbols which used to be common must be left alone */ + Note that symbols which used to be common must be left alone. */ - /* Calculate any reloc addend by looking at the symbol */ + /* Calculate any reloc addend by looking at the symbol. */ CALC_ADDEND (abfd, ptr, *reloc, relent); relent->address -= section->vma; /* !! relent->section = (asection *) NULL;*/ - /* Fill in the relent->howto field from reloc->r_type */ + /* Fill in the relent->howto field from reloc->r_type. */ tic54x_lookup_howto (relent, reloc); } -/* COFF0 differs in file/section header size and relocation entry size */ +/* COFF0 differs in file/section header size and relocation entry size. */ static CONST bfd_coff_backend_data ticoff0_swap_table = -{ - coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, - coff_SWAP_aux_out, coff_SWAP_sym_out, - coff_SWAP_lineno_out, coff_SWAP_reloc_out, - coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, - coff_SWAP_scnhdr_out, - FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, + { + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, #ifdef COFF_LONG_FILENAMES - true, + true, #else - false, + false, #endif #ifdef COFF_LONG_SECTION_NAMES - true, + true, #else - false, + false, #endif #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS - true, + true, #else - false, + false, #endif #ifdef COFF_DEBUG_STRING_WIDE_PREFIX - 4, + 4, #else - 2, + 2, #endif - COFF_DEFAULT_SECTION_ALIGNMENT_POWER, - coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, - coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, - coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, - coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, - coff_classify_symbol, coff_compute_section_file_positions, - coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, - coff_adjust_symndx, coff_link_add_one_symbol, - coff_link_output_has_begun, coff_final_link_postscript -}; - -/* COFF1 differs in section header size */ + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript + }; + +/* COFF1 differs in section header size. */ static CONST bfd_coff_backend_data ticoff1_swap_table = -{ - coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, - coff_SWAP_aux_out, coff_SWAP_sym_out, - coff_SWAP_lineno_out, coff_SWAP_reloc_out, - coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, - coff_SWAP_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, + { + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, #ifdef COFF_LONG_FILENAMES - true, + true, #else - false, + false, #endif #ifdef COFF_LONG_SECTION_NAMES - true, + true, #else - false, + false, #endif - COFF_DEFAULT_SECTION_ALIGNMENT_POWER, + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS - true, + true, #else - false, + false, #endif #ifdef COFF_DEBUG_STRING_WIDE_PREFIX - 4, + 4, #else - 2, + 2, #endif - coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, - coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, - coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, - coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, - coff_classify_symbol, coff_compute_section_file_positions, - coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, - coff_adjust_symndx, coff_link_add_one_symbol, - coff_link_output_has_begun, coff_final_link_postscript -}; - -/* TI COFF v0, DOS tools (little-endian headers) */ + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript + }; + +/* TI COFF v0, DOS tools (little-endian headers). */ const bfd_target tic54x_coff0_vec = -{ - "coff0-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - NULL, - - (PTR)&ticoff0_swap_table -}; - -/* TI COFF v0, SPARC tools (big-endian headers) */ + { + "coff0-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + + (PTR) & ticoff0_swap_table + }; + +/* TI COFF v0, SPARC tools (big-endian headers). */ const bfd_target tic54x_coff0_beh_vec = -{ - "coff0-beh-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - &tic54x_coff0_vec, - - (PTR)&ticoff0_swap_table -}; - -/* TI COFF v1, DOS tools (little-endian headers) */ + { + "coff0-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff0_vec, + + (PTR) & ticoff0_swap_table + }; + +/* TI COFF v1, DOS tools (little-endian headers). */ const bfd_target tic54x_coff1_vec = -{ - "coff1-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - &tic54x_coff0_beh_vec, - - (PTR)&ticoff1_swap_table + { + "coff1-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff0_beh_vec, + + (PTR) & ticoff1_swap_table }; -/* TI COFF v1, SPARC tools (big-endian headers) */ +/* TI COFF v1, SPARC tools (big-endian headers). */ const bfd_target tic54x_coff1_beh_vec = -{ - "coff1-beh-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - &tic54x_coff1_vec, - - (PTR)&ticoff1_swap_table -}; - -/* TI COFF v2, TI DOS tools output (little-endian headers) */ + { + "coff1-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff1_vec, + + (PTR) & ticoff1_swap_table + }; + +/* TI COFF v2, TI DOS tools output (little-endian headers). */ const bfd_target tic54x_coff2_vec = -{ - "coff2-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - &tic54x_coff1_beh_vec, - - COFF_SWAP_TABLE -}; - -/* TI COFF v2, TI SPARC tools output (big-endian headers) */ + { + "coff2-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_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 */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff1_beh_vec, + + COFF_SWAP_TABLE + }; + +/* TI COFF v2, TI SPARC tools output (big-endian headers). */ const bfd_target tic54x_coff2_beh_vec = -{ - "coff2-beh-c54x", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (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 symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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 (tic54x), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - &tic54x_coff2_vec, - - COFF_SWAP_TABLE -}; + { + "coff2-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (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 symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {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 (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff2_vec, + + COFF_SWAP_TABLE + }; diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c index df960ef610b..8ce8ffe7484 100644 --- a/bfd/coff-w65.c +++ b/bfd/coff-w65.c @@ -1,5 +1,5 @@ /* BFD back-end for WDC 65816 COFF binaries. - Copyright 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain, <sac@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -26,23 +26,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" +static int select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static int w65_reloc16_estimate PARAMS ((bfd *, asection *, arelent *, unsigned int, struct bfd_link_info *)); +static void w65_reloc16_extra_cases PARAMS ((bfd *,struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) static reloc_howto_type howto_table[] = -{ - HOWTO (R_W65_ABS8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "abs8", true, 0x000000ff, 0x000000ff, false), - HOWTO (R_W65_ABS16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "abs16", true, 0x0000ffff, 0x0000ffff, false), - HOWTO (R_W65_ABS24, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "abs24", true, 0x00ffffff, 0x00ffffff, false), - HOWTO (R_W65_ABS8S8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, ">abs8", true, 0x000000ff, 0x000000ff, false), - HOWTO (R_W65_ABS8S16, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "^abs8", true, 0x000000ff, 0x000000ff, false), - HOWTO (R_W65_ABS16S8, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, ">abs16", true, 0x0000ffff, 0x0000ffff, false), - HOWTO (R_W65_ABS16S16,1, 0, 16, false, 0, complain_overflow_bitfield, 0, "^abs16", true, 0x0000ffff, 0x0000ffff, false), - HOWTO (R_W65_PCR8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "pcrel8", true, 0x000000ff, 0x000000ff, true), - HOWTO (R_W65_PCR16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "pcrel16", true, 0x0000ffff, 0x0000ffff, true), - HOWTO (R_W65_DP, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "dp", true, 0x000000ff, 0x000000ff, false), - -}; - -/* Turn a howto into a reloc number */ + { + HOWTO (R_W65_ABS8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "abs8", true, 0x000000ff, 0x000000ff, false), + HOWTO (R_W65_ABS16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "abs16", true, 0x0000ffff, 0x0000ffff, false), + HOWTO (R_W65_ABS24, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "abs24", true, 0x00ffffff, 0x00ffffff, false), + HOWTO (R_W65_ABS8S8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, ">abs8", true, 0x000000ff, 0x000000ff, false), + HOWTO (R_W65_ABS8S16, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "^abs8", true, 0x000000ff, 0x000000ff, false), + HOWTO (R_W65_ABS16S8, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, ">abs16", true, 0x0000ffff, 0x0000ffff, false), + HOWTO (R_W65_ABS16S16,1, 0, 16, false, 0, complain_overflow_bitfield, 0, "^abs16", true, 0x0000ffff, 0x0000ffff, false), + HOWTO (R_W65_PCR8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "pcrel8", true, 0x000000ff, 0x000000ff, true), + HOWTO (R_W65_PCR16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "pcrel16", true, 0x0000ffff, 0x0000ffff, true), + HOWTO (R_W65_DP, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "dp", true, 0x000000ff, 0x000000ff, false), + }; + +/* Turn a howto into a reloc number. */ #define SELECT_RELOC(x,howto) \ { x.r_type = select_reloc(howto); } @@ -65,20 +70,19 @@ select_reloc (howto) return howto->type ; } -/* Code to turn a r_type into a howto ptr, uses the above howto table - */ +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void rtype2howto (internal, dst) arelent *internal; struct internal_reloc *dst; { - internal->howto = howto_table + dst->r_type - 1; + internal->howto = howto_table + dst->r_type - 1; } #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessary magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; @@ -98,13 +102,9 @@ reloc_processing (relent, reloc, symbols, abfd, section) rtype2howto (relent, reloc); if (((int) reloc->r_symndx) > 0) - { - relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; - } + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; else - { - relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol); - } + relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol); relent->addend = reloc->r_offset; @@ -113,7 +113,7 @@ reloc_processing (relent, reloc, symbols, abfd, section) } static int -h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) +w65_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) bfd *abfd; asection *input_section; arelent *reloc; @@ -127,7 +127,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) /* The address of the thing to be relocated will have moved back by the size of the shrink - but we don't change reloc->address here, since we need it to know where the relocation lives in the source - uncooked section */ + uncooked section. */ /* reloc->address -= shrink; conceptual */ @@ -140,75 +140,69 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) shrink+=2; break; - /* Thing is a move one byte */ + /* Thing is a move one byte. */ case R_MOV16B1: - value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); if (value >= 0xff00) { - /* Change the reloc type from 16bit, possible 8 to 8bit - possible 16 */ + possible 16. */ reloc->howto = reloc->howto + 1; - /* The place to relc moves back by one */ - /* This will be two bytes smaller in the long run */ - shrink +=2 ; - bfd_perform_slip(abfd, 2, input_section, address); + /* The place to relc moves back by one. */ + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); } break; /* This is the 24 bit branch which could become an 8 bitter, - the relocation points to the first byte of the insn, not the - actual data */ + the relocation points to the first byte of the insn, not the + actual data. */ case R_JMPL1: - value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); dot = input_section->output_section->vma + input_section->output_offset + address; /* See if the address we're looking at within 127 bytes of where we are, if so then we can use a small branch rather than the - jump we were going to */ - - gap = value - dot ; + jump we were going to. */ + gap = value - dot; - if (-120 < (long)gap && (long)gap < 120 ) + if (-120 < (long) gap && (long) gap < 120) { - /* Change the reloc type from 24bit, possible 8 to 8bit - possible 32 */ + possible 32. */ reloc->howto = reloc->howto + 1; - /* This will be two bytes smaller in the long run */ - shrink +=2 ; - bfd_perform_slip(abfd, 2, input_section, address); + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); } break; case R_JMP1: - - value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); dot = input_section->output_section->vma + input_section->output_offset + address; /* See if the address we're looking at within 127 bytes of where we are, if so then we can use a small branch rather than the - jump we were going to */ - + jump we were going to. */ gap = value - (dot - shrink); - if (-120 < (long)gap && (long)gap < 120 ) + if (-120 < (long) gap && (long) gap < 120) { - /* Change the reloc type from 16bit, possible 8 to 8bit - possible 16 */ + possible 16. */ reloc->howto = reloc->howto + 1; - /* The place to relc moves back by one */ + /* The place to relc moves back by one. */ - /* This will be two bytes smaller in the long run */ - shrink +=2 ; - bfd_perform_slip(abfd, 2, input_section, address); + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); } break; } @@ -216,19 +210,17 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) return shrink; } -/* First phase of a relaxing link */ +/* First phase of a relaxing link. */ /* Reloc types large small R_MOV16B1 R_MOV16B2 mov.b with 16bit or 8 bit address R_JMP1 R_JMP2 jmp or pcrel branch R_JMPL1 R_JMPL_B8 24jmp or pcrel branch - R_MOV24B1 R_MOV24B2 24 or 8 bit reloc for mov.b - -*/ + R_MOV24B1 R_MOV24B2 24 or 8 bit reloc for mov.b */ static void -h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, +w65_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) bfd *abfd; struct bfd_link_info *link_info; @@ -270,7 +262,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, { unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - gap >>=16; + gap >>= 16; bfd_put_8 (abfd, gap, data + dst_address); dst_address += 1; src_address += 1; @@ -313,7 +305,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); bfd_put_16 (abfd, gap, data + dst_address); - bfd_put_8 (abfd, gap>>16, data+dst_address+2); + bfd_put_8 (abfd, gap >> 16, data+dst_address + 2); dst_address += 3; src_address += 3; } @@ -328,13 +320,14 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, + link_order->u.indirect.section->output_section->vma; gap -= dot + 1; - if (gap < -128 || gap > 127) { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + if (gap < -128 || gap > 127) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } bfd_put_8 (abfd, gap, data + dst_address); dst_address += 1; src_address += 1; @@ -350,14 +343,15 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, + link_order->u.indirect.section->output_section->vma; /* This wraps within the page, so ignore the relativeness, look at the - high part */ - if ((gap & 0xf0000) != (dot & 0xf0000)) { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + high part. */ + if ((gap & 0xf0000) != (dot & 0xf0000)) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } gap -= dot + 2; bfd_put_16 (abfd, gap, data + dst_address); @@ -372,11 +366,10 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, } *src_ptr = src_address; *dst_ptr = dst_address; - } -#define coff_reloc16_extra_cases h8300_reloc16_extra_cases -#define coff_reloc16_estimate h8300_reloc16_estimate +#define coff_reloc16_extra_cases w65_reloc16_extra_cases +#define coff_reloc16_estimate w65_reloc16_estimate #include "coffcode.h" diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 794ea8740ce..0eda8ee40cb 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -28,6 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" +static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *)); + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) static reloc_howto_type r_imm32 = @@ -81,15 +86,14 @@ coff_z8k_select_reloc (howto) #define Z8K 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ -/* Code to swap in the reloc */ +/* Code to swap in the reloc. */ #define SWAP_IN_RELOC_OFFSET bfd_h_get_32 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; -/* Code to turn a r_type into a howto ptr, uses the above howto table - */ +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void rtype2howto (internal, dst) @@ -128,9 +132,9 @@ rtype2howto (internal, dst) } } -#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) +#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry) -/* Perform any necessary magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; |