diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 60 | ||||
-rw-r--r-- | bfd/Makefile.am | 3 | ||||
-rw-r--r-- | bfd/Makefile.in | 3 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 419 | ||||
-rw-r--r-- | bfd/coff-tic54x.c | 20 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 479 | ||||
-rw-r--r-- | bfd/coffcode.h | 46 | ||||
-rw-r--r-- | bfd/coffgen.c | 41 | ||||
-rw-r--r-- | bfd/coffswap.h | 95 | ||||
-rw-r--r-- | bfd/config.bfd | 3 | ||||
-rwxr-xr-x | bfd/configure | 28 | ||||
-rw-r--r-- | bfd/configure.in | 2 | ||||
-rw-r--r-- | bfd/cpu-powerpc.c | 14 | ||||
-rw-r--r-- | bfd/libcoff.h | 8 | ||||
-rw-r--r-- | bfd/reloc.c | 2 | ||||
-rw-r--r-- | bfd/targets.c | 2 | ||||
-rw-r--r-- | bfd/xcofflink.c | 1 |
17 files changed, 1087 insertions, 139 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e6f92be..4190359 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,63 @@ +Mon Apr 24 15:20:35 2000 Clinton Popetz <cpopetz@cygnus.com> + + * Makefile.am (coff64-rs6000.lo): New rule. + * Makefile.in: Regenerate. + * coff-rs6000.c (xcoff_mkobject, xcoff_copy_private_bfd_data, + xcoff_is_local_label_name, xcoff_rtype2howto, + xcoff_reloc_type_lookup, xcoff_slurp_armap, xcoff_archive_p, + xcoff_read_ar_hdr, xcoff_openr_next_archived_file, xcoff_write_armap, + xcoff_write_archive_contents): No longer static, and prefix with _bfd_. + (NO_COFF_SYMBOLS): Define. + (xcoff64_swap_sym_in, xcoff64_swap_sym_out, xcoff64_swap_aux_in, + xcoff64_swap_aux_out): New functions; handle xcoff symbol tables + internally. + (MINUS_ONE): New macro. + (xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS + relocation. + (coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in, + coff_SWAP_aux_out): Map to the new functions. + * coff64-rs6000.c: New file. + * libcoff.h (bfd_coff_backend_data): Add new fields + _bfd_coff_force_symnames_in_strings and + _bfd_coff_debug_string_prefix_length. + (bfd_coff_force_symnames_in_strings, + bfd_coff_debug_string_prefix_length): New macros for above fields. + * coffcode.h (coff_set_arch_mach_hook): Handle XCOFF64 magic. + Set machine to 620 for XCOFF64. Use bfd_coff_swap_sym_in instead + of using coff_swap_sym_in directly. + (FORCE_SYMNAMES_IN_STRINGS): New macro, defined for XCOFF64. + (coff_set_flags) Set magic for XCOFF64. + (coff_compute_section_file_positions): Add symbol name length to + string section length if bfd_coff_debug_string_prefix_length is + true. + (coff_write_object_contents): Don't do reloc overflow for XCOFF64. + (coff_slurp_line_table): Use bfd_coff_swap_lineno_in instead of + using coff_swap_lineno_in directly. + (bfd_coff_backend_data): Add _bfd_coff_force_symnames_in_strings + and _bfd_coff_debug_string_prefix_length fields. + * coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force + symbol names into strings table when + bfd_coff_force_symnames_in_strings is true. + * coffswap.h (MAX_SCNHDR_NRELOC, MAX_SCNHDR_NLNNO, GET_RELOC_VADDR, + SET_RELOC_VADDR): New macros. + (coff_swap_reloc_in, coff_swap_reloc_out): Use above macros. + (coff_swap_aux_in, coff_swap_aux_out): Remove RS6000COFF_C + code. + (coff_swap_aouthdr_in, coff_swap_aouthdr_out): Handle XCOFF64 + changes within RS6000COFF_C specific code. + (coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC, + MAX_SCNHDR_NRELOC, and MAX_SCNHDR_NLNNO. + * reloc.c (bfd_perform_relocation, bfd_install_relocation): + Extend existing hack on target name. + * xcofflink.c (XCOFF_XVECP): Extend existing hack on + target name. + * coff-tic54x.c (ticof): Keep up to date with new fields + in bfd_coff_backend_data. + * config.bfd: Add bfd_powerpc_64_arch to targ_arch and define + targ_selvecs to include rs6000coff64_vec for rs6000. + * configure.in: Add rs6000coff64_vec case. + * cpu-powerpc.c: New bfd_arch_info_type. + Mon Apr 24 02:17:31 2000 Jeffrey A Law (law@cygnus.com) * config.bfd: Only disable elf32-hppa vectors, not all of the diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 83fd192..8a36f0e 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -818,6 +818,9 @@ coff-pmac.lo: coff-pmac.c coff-rs6000.c $(INCDIR)/coff/internal.h \ coff-rs6000.lo: coff-rs6000.c $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h +coff64-rs6000.lo: coff64-rs6000.c coff-rs6000.c $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-sh.lo: coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-sparc.lo: coff-sparc.c $(INCDIR)/coff/sparc.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 26692fa..329d22e 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1346,6 +1346,9 @@ coff-pmac.lo: coff-pmac.c coff-rs6000.c $(INCDIR)/coff/internal.h \ coff-rs6000.lo: coff-rs6000.c $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h +coff64-rs6000.lo: coff64-rs6000.c coff-rs6000.c $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-sh.lo: coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-sparc.lo: coff-sparc.c $(INCDIR)/coff/sparc.h \ diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 6f8563f..b1384ed 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -38,29 +38,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* The main body of code is in coffcode.h. */ -static boolean xcoff_mkobject PARAMS ((bfd *)); -static boolean xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -static boolean xcoff_is_local_label_name PARAMS ((bfd *, const char *)); -static void xcoff_rtype2howto +boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); +boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); +void _bfd_xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); -static reloc_howto_type *xcoff_reloc_type_lookup +reloc_howto_type *_bfd_xcoff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); -static boolean xcoff_slurp_armap PARAMS ((bfd *)); -static const bfd_target *xcoff_archive_p PARAMS ((bfd *)); -static PTR xcoff_read_ar_hdr PARAMS ((bfd *)); -static bfd *xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -static int xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); +const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *)); +PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); +bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); +int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); static const char *normalize_filename PARAMS ((bfd *)); -static boolean xcoff_write_armap +boolean _bfd_xcoff_write_armap PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -static boolean xcoff_write_archive_contents PARAMS ((bfd *)); -static int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); +boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); +int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); /* We use our own tdata type. Its first field is the COFF tdata type, so the COFF routines are compatible. */ -static boolean -xcoff_mkobject (abfd) +boolean +_bfd_xcoff_mkobject (abfd) bfd *abfd; { coff_data_type *coff; @@ -90,8 +90,8 @@ xcoff_mkobject (abfd) /* Copy XCOFF data from one BFD to another. */ -static boolean -xcoff_copy_private_bfd_data (ibfd, obfd) +boolean +_bfd_xcoff_copy_private_bfd_data (ibfd, obfd) bfd *ibfd; bfd *obfd; { @@ -138,21 +138,310 @@ xcoff_copy_private_bfd_data (ibfd, obfd) The AIX native linker does not have a -X option, and it ignores the -x option. */ -static boolean -xcoff_is_local_label_name (abfd, name) +boolean +_bfd_xcoff_is_local_label_name (abfd, name) bfd *abfd ATTRIBUTE_UNUSED; const char *name ATTRIBUTE_UNUSED; { return false; } + +#define NO_COFF_SYMBOLS + +static void xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +static void xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static unsigned int xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + +static void +xcoff_swap_sym_in (abfd, ext1, in1) + bfd *abfd; + PTR ext1; + PTR in1; +{ + SYMENT *ext = (SYMENT *)ext1; + 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); + } + + 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); +} + +static unsigned int +xcoff_swap_sym_out (abfd, inp, extp) + bfd *abfd; + PTR inp; + PTR 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); + } + + 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); +} + +#define PUTWORD bfd_h_put_32 +#define PUTHALF bfd_h_put_16 +#define PUTBYTE bfd_h_put_8 +#define GETWORD bfd_h_get_32 +#define GETHALF bfd_h_get_16 +#define GETBYTE bfd_h_get_8 + +static void +xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) + bfd *abfd; + PTR ext1; + int type; + int class; + int indx; + int numaux; + PTR in1; +{ + AUXENT *ext = (AUXENT *)ext1; + union internal_auxent *in = (union internal_auxent *)in1; + + switch (class) { + case C_FILE: + 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); + } + } + goto end; + + /* RS/6000 "csect" auxents */ + case C_EXT: + case C_HIDEXT: + if (indx + 1 == numaux) + { + in->x_csect.x_scnlen.l = + bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); + in->x_csect.x_parmhash = bfd_h_get_32 (abfd, + ext->x_csect.x_parmhash); + in->x_csect.x_snhash = bfd_h_get_16 (abfd, 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. */ + in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); + in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); + in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); + in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); + goto end; + } + break; + + case C_STAT: + case C_LEAFSTAT: + case C_HIDDEN: + 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, + (bfd_byte *) ext->x_scn.x_nreloc); + in->x_scn.x_nlinno = bfd_h_get_16(abfd, + (bfd_byte *) ext->x_scn.x_nlinno); + /* PE defines some extra fields; we zero them out for + safety. */ + in->x_scn.x_checksum = 0; + in->x_scn.x_associated = 0; + in->x_scn.x_comdat = 0; + + goto end; + } + break; + } + + in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); + in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_fcn.x_endndx); + } + else + { + in->x_sym.x_fcnary.x_ary.x_dimen[0] = + bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + in->x_sym.x_fcnary.x_ary.x_dimen[1] = + bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + in->x_sym.x_fcnary.x_ary.x_dimen[2] = + bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + 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. */ + +} + + + +static unsigned int +xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp; +{ + union internal_auxent *in = (union internal_auxent *)inp; + AUXENT *ext = (AUXENT *)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); + goto end; + } + break; + } + + PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); + PUTWORD(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); + } + else + { + bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], + (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], + (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], + (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], + (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + } + + if (ISFCN (type)) + PUTWORD (abfd, in->x_sym.x_misc.x_fsize, + (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); + } + +end: + return bfd_coff_auxesz (abfd); +} + + + /* The XCOFF reloc table. Actually, XCOFF relocations specify the bitsize and whether they are signed or not, along with a conventional type. This table is for the types, which are used for different algorithms for putting in the reloc. Many of these relocs need special_function entries, which I have not written. */ -static reloc_howto_type xcoff_howto_table[] = +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value + from smaller values. Start with zero, widen, *then* decrement. */ +#define MINUS_ONE (((bfd_vma)0) - 1) + +reloc_howto_type xcoff_howto_table[] = { /* Standard 32 bit relocation. */ HOWTO (0, /* type */ @@ -493,7 +782,21 @@ static reloc_howto_type xcoff_howto_table[] = true, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (0, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_POS", /* name */ + true, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ false) /* pcrel_offset */ + }; /* These are the first two like the above but for 16-bit relocs. */ @@ -542,11 +845,11 @@ static reloc_howto_type xcoff_howto_table_16[] = true, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ -}; + false) /* pcrel_offset */ + }; -static void -xcoff_rtype2howto (relent, internal) +void +_bfd_xcoff_rtype2howto (relent, internal) arelent *relent; struct internal_reloc *internal; { @@ -571,8 +874,8 @@ xcoff_rtype2howto (relent, internal) #endif } -static reloc_howto_type * -xcoff_reloc_type_lookup (abfd, code) +reloc_howto_type * +_bfd_xcoff_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code; { @@ -587,6 +890,8 @@ xcoff_reloc_type_lookup (abfd, code) case BFD_RELOC_32: case BFD_RELOC_CTOR: return &xcoff_howto_table[0]; + case BFD_RELOC_64: + return &xcoff_howto_table[0x1c]; default: return NULL; } @@ -606,12 +911,16 @@ xcoff_reloc_type_lookup (abfd, code) #define COFF_LONG_FILENAMES -#define RTYPE2HOWTO(cache_ptr, dst) xcoff_rtype2howto (cache_ptr, dst) +#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) -#define coff_mkobject xcoff_mkobject -#define coff_bfd_copy_private_bfd_data xcoff_copy_private_bfd_data -#define coff_bfd_is_local_label_name xcoff_is_local_label_name -#define coff_bfd_reloc_type_lookup xcoff_reloc_type_lookup +#define coff_SWAP_sym_in xcoff_swap_sym_in +#define coff_SWAP_sym_out xcoff_swap_sym_out +#define coff_SWAP_aux_in xcoff_swap_aux_in +#define coff_SWAP_aux_out xcoff_swap_aux_out +#define coff_mkobject _bfd_xcoff_mkobject +#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup #define coff_relocate_section _bfd_ppc_xcoff_relocate_section #include "coffcode.h" @@ -829,24 +1138,24 @@ struct xcoff_ar_hdr_big /* XCOFF archives do not have anything which corresponds to an extended name table. */ -#define xcoff_slurp_extended_name_table bfd_false -#define xcoff_construct_extended_name_table \ +#define _bfd_xcoff_slurp_extended_name_table bfd_false +#define _bfd_xcoff_construct_extended_name_table \ ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ bfd_false) -#define xcoff_truncate_arname bfd_dont_truncate_arname +#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname /* We can use the standard get_elt_at_index routine. */ -#define xcoff_get_elt_at_index _bfd_generic_get_elt_at_index +#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index /* XCOFF archives do not have a timestamp. */ -#define xcoff_update_armap_timestamp bfd_true +#define _bfd_xcoff_update_armap_timestamp bfd_true /* Read in the armap of an XCOFF archive. */ -static boolean -xcoff_slurp_armap (abfd) +boolean +_bfd_xcoff_slurp_armap (abfd) bfd *abfd; { file_ptr off; @@ -969,8 +1278,8 @@ xcoff_slurp_armap (abfd) /* See if this is an XCOFF archive. */ -static const bfd_target * -xcoff_archive_p (abfd) +const bfd_target * +_bfd_xcoff_archive_p (abfd) bfd *abfd; { char magic[SXCOFFARMAG]; @@ -1060,7 +1369,7 @@ xcoff_archive_p (abfd) memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG); } - if (! xcoff_slurp_armap (abfd)) + if (! _bfd_xcoff_slurp_armap (abfd)) { bfd_release (abfd, bfd_ardata (abfd)); abfd->tdata.aout_ar_data = (struct artdata *) NULL; @@ -1072,8 +1381,8 @@ xcoff_archive_p (abfd) /* Read the archive header in an XCOFF archive. */ -static PTR -xcoff_read_ar_hdr (abfd) +PTR +_bfd_xcoff_read_ar_hdr (abfd) bfd *abfd; { size_t namlen; @@ -1160,8 +1469,8 @@ xcoff_read_ar_hdr (abfd) /* Open the next element in an XCOFF archive. */ -static bfd * -xcoff_openr_next_archived_file (archive, last_file) +bfd * +_bfd_xcoff_openr_next_archived_file (archive, last_file) bfd *archive; bfd *last_file; { @@ -1221,8 +1530,8 @@ xcoff_openr_next_archived_file (archive, last_file) /* Stat an element in an XCOFF archive. */ -static int -xcoff_generic_stat_arch_elt (abfd, s) +int +_bfd_xcoff_generic_stat_arch_elt (abfd, s) bfd *abfd; struct stat *s; { @@ -1452,8 +1761,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } /*ARGSUSED*/ -static boolean -xcoff_write_armap (abfd, elength, map, orl_count, stridx) +boolean +_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx) bfd *abfd; unsigned int elength ATTRIBUTE_UNUSED; struct orl *map; @@ -1983,8 +2292,8 @@ xcoff_write_archive_contents_big (abfd) return true; } -static boolean -xcoff_write_archive_contents (abfd) +boolean +_bfd_xcoff_write_archive_contents (abfd) bfd *abfd; { if (! xcoff_big_format_p (abfd)) @@ -1997,7 +2306,7 @@ xcoff_write_archive_contents (abfd) always uses an a.out header. */ /*ARGSUSED*/ -static int +int _bfd_xcoff_sizeof_headers (abfd, reloc) bfd *abfd; boolean reloc ATTRIBUTE_UNUSED; @@ -2105,16 +2414,16 @@ const bfd_target bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - xcoff_archive_p, CORE_FILE_P}, + _bfd_xcoff_archive_p, CORE_FILE_P}, {bfd_false, coff_mkobject, /* bfd_set_format */ _bfd_generic_mkarchive, bfd_false}, {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - xcoff_write_archive_contents, bfd_false}, + _bfd_xcoff_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (coff), BFD_JUMP_TABLE_COPY (coff), BFD_JUMP_TABLE_CORE (coff), - BFD_JUMP_TABLE_ARCHIVE (xcoff), + BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), BFD_JUMP_TABLE_WRITE (coff), diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 4cfa27e..4ae62e3 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -428,6 +428,16 @@ static CONST bfd_coff_backend_data ticoff0_swap_table = #else false, #endif +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + true, +#else + false, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 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, @@ -460,6 +470,16 @@ static CONST bfd_coff_backend_data ticoff1_swap_table = false, #endif COFF_DEFAULT_SECTION_ALIGNMENT_POWER, +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + true, +#else + false, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 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, diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c new file mode 100644 index 0000000..a417039 --- /dev/null +++ b/bfd/coff64-rs6000.c @@ -0,0 +1,479 @@ +/* BFD back-end for IBM RS/6000 "XCOFF64" files. + Copyright 2000 + Free Software Foundation, Inc. + Written Clinton Popetz. + Contributed by Cygnus Support. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Internalcoff.h and coffcode.h modify themselves based on these flags. */ +#define XCOFF64 +#define RS6000COFF_C 1 + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/internal.h" +#include "coff/rs6k64.h" +#include "libcoff.h" + + +#define GET_FILEHDR_SYMPTR bfd_h_get_64 +#define PUT_FILEHDR_SYMPTR bfd_h_put_64 +#define GET_AOUTHDR_DATA_START bfd_h_get_64 +#define PUT_AOUTHDR_DATA_START bfd_h_put_64 +#define GET_AOUTHDR_TEXT_START bfd_h_get_64 +#define PUT_AOUTHDR_TEXT_START bfd_h_put_64 +#define GET_AOUTHDR_TSIZE bfd_h_get_64 +#define PUT_AOUTHDR_TSIZE bfd_h_put_64 +#define GET_AOUTHDR_DSIZE bfd_h_get_64 +#define PUT_AOUTHDR_DSIZE bfd_h_put_64 +#define GET_AOUTHDR_BSIZE bfd_h_get_64 +#define PUT_AOUTHDR_BSIZE bfd_h_put_64 +#define GET_AOUTHDR_ENTRY bfd_h_get_64 +#define PUT_AOUTHDR_ENTRY bfd_h_put_64 +#define GET_SCNHDR_PADDR bfd_h_get_64 +#define PUT_SCNHDR_PADDR bfd_h_put_64 +#define GET_SCNHDR_VADDR bfd_h_get_64 +#define PUT_SCNHDR_VADDR bfd_h_put_64 +#define GET_SCNHDR_SIZE bfd_h_get_64 +#define PUT_SCNHDR_SIZE bfd_h_put_64 +#define GET_SCNHDR_SCNPTR bfd_h_get_64 +#define PUT_SCNHDR_SCNPTR bfd_h_put_64 +#define GET_SCNHDR_RELPTR bfd_h_get_64 +#define PUT_SCNHDR_RELPTR bfd_h_put_64 +#define GET_SCNHDR_LNNOPTR bfd_h_get_64 +#define PUT_SCNHDR_LNNOPTR bfd_h_put_64 +#define GET_SCNHDR_NRELOC bfd_h_get_32 +#define MAX_SCNHDR_NRELOC 0xffffffff +#define PUT_SCNHDR_NRELOC bfd_h_put_32 +#define GET_SCNHDR_NLNNO bfd_h_get_32 +#define MAX_SCNHDR_NLNNO 0xffffffff +#define PUT_SCNHDR_NLNNO bfd_h_put_32 +#define GET_RELOC_VADDR bfd_h_get_64 +#define PUT_RELOC_VADDR bfd_h_put_64 + +#define COFF_FORCE_SYMBOLS_IN_STRINGS +#define COFF_DEBUG_STRING_WIDE_PREFIX + +#define TARGET_SYM rs6000coff64_vec +#define TARGET_NAME "aixcoff64-rs6000" + +#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \ +do { \ + memset (((SCNHDR *)EXT)->s_pad, 0, sizeof (((SCNHDR *)EXT)->s_pad));\ +} while(0) + +#define NO_COFF_LINENOS + +#define coff_SWAP_lineno_in xcoff64_swap_lineno_in +#define coff_SWAP_lineno_out xcoff64_swap_lineno_out + +#define PUTWORD bfd_h_put_32 +#define PUTHALF bfd_h_put_16 +#define PUTBYTE bfd_h_put_8 +#define GETWORD bfd_h_get_32 +#define GETHALF bfd_h_get_16 +#define GETBYTE bfd_h_get_8 + + +/* For XCOFF64, the effective width of symndx changes depending on + whether we are the first entry. Sigh. */ +static void +xcoff64_swap_lineno_in (abfd, ext1, in1) + bfd *abfd; + PTR ext1; + PTR in1; +{ + LINENO *ext = (LINENO *)ext1; + struct internal_lineno *in = (struct internal_lineno *)in1; + + in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); + if (in->l_lnno == 0) + in->l_addr.l_symndx = + bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx); + else + in->l_addr.l_symndx = + bfd_h_get_64(abfd, (bfd_byte *) ext->l_addr.l_symndx); +} + +static unsigned int +xcoff64_swap_lineno_out (abfd, inp, outp) + bfd *abfd; + PTR inp; + PTR outp; +{ + struct internal_lineno *in = (struct internal_lineno *)inp; + struct external_lineno *ext = (struct external_lineno *)outp; + PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) + ext->l_addr.l_symndx); + + bfd_h_put_32 (abfd, in->l_lnno, (bfd_byte *) (ext->l_lnno)); + if (in->l_lnno == 0) + bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *)ext->l_addr.l_symndx); + else + bfd_h_put_64 (abfd, in->l_addr.l_symndx, (bfd_byte *)ext->l_addr.l_symndx); + + return bfd_coff_linesz (abfd); +} + +#define NO_COFF_SYMBOLS + +static void xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +static void xcoff64_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static unsigned int xcoff64_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + +static void +xcoff64_swap_sym_in (abfd, ext1, in1) + bfd *abfd; + PTR ext1; + PTR in1; +{ + SYMENT *ext = (SYMENT *)ext1; + struct internal_syment *in = (struct internal_syment *)in1; + + + in->_n._n_n._n_zeroes = 0; + in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e_offset); + in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.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); +} + +static unsigned int +xcoff64_swap_sym_out (abfd, inp, extp) + bfd *abfd; + PTR inp; + PTR extp; +{ + struct internal_syment *in = (struct internal_syment *)inp; + SYMENT *ext =(SYMENT *)extp; + + bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e_offset); + bfd_h_put_64(abfd, in->n_value , (bfd_byte *) ext->e.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); +} + +static void +xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) + bfd *abfd; + PTR ext1; + int type; + int class; + int indx; + int numaux; + PTR in1; +{ + AUXENT *ext = (AUXENT *)ext1; + union internal_auxent *in = (union internal_auxent *)in1; + + switch (class) { + case C_FILE: + 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); + } + } + goto end; + + /* RS/6000 "csect" auxents */ + case C_EXT: + case C_HIDEXT: + if (indx + 1 == numaux) + { + in->x_csect.x_scnlen.l = + bfd_h_get_32(abfd, ext->x_csect.x_scnlen_lo); + /* FIXME: If we want section lengths larger than 32 bits, we need + to modify the internal coff structures to support it. */ + in->x_csect.x_parmhash = bfd_h_get_32 (abfd, + ext->x_csect.x_parmhash); + in->x_csect.x_snhash = bfd_h_get_16 (abfd, 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. */ + in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); + in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); + goto end; + } + break; + + case C_STAT: + case C_LEAFSTAT: + case C_HIDDEN: + if (type == T_NULL) { + /* PE defines some extra fields; we zero them out for + safety. */ + in->x_scn.x_checksum = 0; + in->x_scn.x_associated = 0; + in->x_scn.x_comdat = 0; + + goto end; + } + break; + } + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_64(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_fcn.x_endndx); + } + if (ISFCN(type)) { + in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize); + } + else { + in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_32(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_lnsz.x_lnno); + in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *) + ext->x_sym.x_fcnary.x_lnsz.x_size); + } + +end: ; + /* the semicolon is because MSVC doesn't like labels at + end of block. */ + +} + + + +static unsigned int +xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp; +{ + union internal_auxent *in = (union internal_auxent *)inp; + AUXENT *ext = (AUXENT *)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); + } + PUTBYTE (abfd, _AUX_FILE, (bfd_byte *) ext->x_auxtype.x_auxtype); + 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_lo); + 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); + PUTBYTE (abfd, _AUX_CSECT, (bfd_byte *) ext->x_auxtype.x_auxtype); + goto end; + } + break; + + case C_STAT: + case C_LEAFSTAT: + case C_HIDDEN: + if (type == T_NULL) { + goto end; + } + break; + } + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + bfd_h_put_64(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, + (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + PUTBYTE (abfd, _AUX_FCN, (bfd_byte *) ext->x_auxtype.x_auxtype); + PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); + } + if (ISFCN (type)) + PUTWORD (abfd, in->x_sym.x_misc.x_fsize, + (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize); + else + { + bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, + (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_lnno); + bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, + (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_size); + } + +end: + return bfd_coff_auxesz (abfd); +} + +#define SELECT_RELOC(internal, howto) \ + { \ + internal.r_type = howto->type; \ + internal.r_size = \ + ((howto->complain_on_overflow == complain_overflow_signed \ + ? 0x80 \ + : 0) \ + | (howto->bitsize - 1)); \ + } + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +#define COFF_LONG_FILENAMES + +#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) + +#define coff_SWAP_sym_in xcoff64_swap_sym_in +#define coff_SWAP_sym_out xcoff64_swap_sym_out +#define coff_SWAP_aux_in xcoff64_swap_aux_in +#define coff_SWAP_aux_out xcoff64_swap_aux_out +#define coff_mkobject _bfd_xcoff_mkobject +#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_relocate_section _bfd_ppc_xcoff_relocate_section + +extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); +extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); +extern void _bfd_xcoff_rtype2howto + PARAMS ((arelent *, struct internal_reloc *)); +extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); +extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *)); +extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); +extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); +extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +extern boolean _bfd_xcoff_write_armap + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); +extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); + +#define _bfd_xcoff_slurp_extended_name_table bfd_false +#define _bfd_xcoff_construct_extended_name_table \ + ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + bfd_false) +#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname + +/* We can use the standard get_elt_at_index routine. */ + +#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index + +/* XCOFF archives do not have a timestamp. */ + +#define _bfd_xcoff_update_armap_timestamp bfd_true + +#include "coffcode.h" + +#define CORE_FILE_P _bfd_dummy_target + +#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command +#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal +#define coff_core_file_matches_executable_p \ + _bfd_nocore_core_file_matches_executable_p + +#define _bfd_xcoff_bfd_get_relocated_section_contents \ + coff_bfd_get_relocated_section_contents +#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section +#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections +#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section + +/* The transfer vector that leads the outside world to all of the above. */ + +const bfd_target +#ifdef TARGET_SYM + TARGET_SYM = +#else + rs6000coff64_vec = +#endif +{ +#ifdef TARGET_NAME + TARGET_NAME, +#else + "aixcoff64-rs6000", /* name */ +#endif + bfd_target_coff_flavour, + BFD_ENDIAN_BIG, /* data byte order is big */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | DYNAMIC | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* leading char */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen??? FIXMEmgo */ + + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* 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_xcoff_archive_p, CORE_FILE_P}, + {bfd_false, coff_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_xcoff_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (coff), + BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (_bfd_xcoff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff), + + NULL, + + COFF_SWAP_TABLE +}; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 9474e93..08e99f6 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1901,9 +1901,13 @@ coff_set_arch_mach_hook (abfd, filehdr) #endif #ifdef RS6000COFF_C +#ifdef XCOFF64 + case U802TOC64MAGIC: +#else case U802ROMAGIC: case U802WRMAGIC: case U802TOCMAGIC: +#endif { int cputype; @@ -1930,7 +1934,7 @@ coff_set_arch_mach_hook (abfd, filehdr) free (buf); return false; } - coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym); + bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym); if (sym.n_sclass == C_FILE) cputype = sym.n_type & 0xff; else @@ -1952,7 +1956,11 @@ coff_set_arch_mach_hook (abfd, filehdr) machine = 0; #else arch = bfd_arch_rs6000; +#ifdef XCOFF64 + machine = 620; +#else machine = 6000; +#endif #endif /* POWERMAC */ break; @@ -2125,6 +2133,10 @@ symname_in_debug_hook (abfd, sym) #ifdef RS6000COFF_C +#ifdef XCOFF64 +#define FORCE_SYMNAMES_IN_STRINGS +#endif + /* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */ static boolean coff_pointerize_aux_hook @@ -2667,12 +2679,18 @@ coff_set_flags (abfd, magicp, flagsp) break; #endif -#ifdef U802TOCMAGIC +#ifdef RS6000COFF_C case bfd_arch_rs6000: #ifndef PPCMAGIC case bfd_arch_powerpc: #endif - *magicp = U802TOCMAGIC; +#ifdef XCOFF64 + if (bfd_get_mach (abfd) == 620 && !strncmp (abfd->xvec->name,"aix", 3)) + *magicp = U802TOC64MAGIC; + else +#else + *magicp = U802TOCMAGIC; +#endif return true; break; #endif @@ -2780,8 +2798,8 @@ coff_compute_section_file_positions (abfd) size_t len; len = strlen (bfd_asymbol_name (*symp)); - if (len > SYMNMLEN) - sz += len + 3; + if (len > SYMNMLEN || bfd_coff_force_symnames_in_strings (abfd)) + sz += len + 1 + bfd_coff_debug_string_prefix_length (abfd); } } if (sz > 0) @@ -3309,7 +3327,8 @@ coff_write_object_contents (abfd) && ! is_reloc_section) hasdebug = true; -#ifdef RS6000COFF_C +#ifdef RS6000COFF_C +#ifndef XCOFF64 /* Indicate the use of an XCOFF overflow section header. */ if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff) { @@ -3317,6 +3336,7 @@ coff_write_object_contents (abfd) section.s_nlnno = 0xffff; } #endif +#endif section.s_flags = sec_to_styp_flags (current->name, current->flags); @@ -4068,7 +4088,7 @@ coff_slurp_line_table (abfd, asect) while (counter < asect->lineno_count) { struct internal_lineno dst; - coff_swap_lineno_in (abfd, src, &dst); + bfd_coff_swap_lineno_in (abfd, src, &dst); cache_ptr->line_number = dst.l_lnno; if (cache_ptr->line_number == 0) @@ -5009,7 +5029,17 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table = #else false, #endif - COFF_DEFAULT_SECTION_ALIGNMENT_POWER, + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + true, +#else + false, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 2, +#endif coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 47e5baa..bb7f862 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -819,7 +819,16 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, { unsigned int filnmlen; - strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN); + if (bfd_coff_force_symnames_in_strings (abfd)) + { + native->u.syment._n._n_n._n_offset = + (*string_size_p + STRING_SIZE_SIZE); + native->u.syment._n._n_n._n_zeroes = 0; + *string_size_p += 6; /* strlen(".file") + 1 */ + } + else + strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN); + auxent = &(native + 1)->u.auxent; filnmlen = bfd_coff_filnmlen (abfd); @@ -846,7 +855,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, } else { - if (name_length <= SYMNMLEN) + if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd)) { /* This name will fit into the symbol neatly */ strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN); @@ -861,7 +870,8 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, else { long filepos; - bfd_byte buf[2]; + bfd_byte buf[4]; + int prefix_len = bfd_coff_debug_string_prefix_length (abfd); /* This name should be written into the .debug section. For some reason each name is preceded by a two byte length @@ -871,24 +881,29 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, if (*debug_string_section_p == (asection *) NULL) *debug_string_section_p = bfd_get_section_by_name (abfd, ".debug"); filepos = bfd_tell (abfd); - bfd_put_16 (abfd, name_length + 1, buf); + if (prefix_len == 4) + bfd_put_32 (abfd, name_length + 1, buf); + else + bfd_put_16 (abfd, name_length + 1, buf); + if (!bfd_set_section_contents (abfd, *debug_string_section_p, (PTR) buf, (file_ptr) *debug_string_size_p, - (bfd_size_type) 2) + (bfd_size_type) prefix_len) || !bfd_set_section_contents (abfd, *debug_string_section_p, (PTR) symbol->name, ((file_ptr) *debug_string_size_p - + 2), + + prefix_len), (bfd_size_type) name_length + 1)) abort (); if (bfd_seek (abfd, filepos, SEEK_SET) != 0) abort (); - native->u.syment._n._n_n._n_offset = *debug_string_size_p + 2; + native->u.syment._n._n_n._n_offset = + *debug_string_size_p + prefix_len; native->u.syment._n._n_n._n_zeroes = 0; - *debug_string_size_p += name_length + 3; + *debug_string_size_p += name_length + 1 + prefix_len; } } } @@ -1244,7 +1259,7 @@ coff_write_symbols (abfd) { /* This is not a COFF symbol, so it certainly is not a file name, nor does it go in the .debug section. */ - maxlen = SYMNMLEN; + maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; } else if (bfd_coff_symname_in_debug (abfd, &c_symbol->native->u.syment)) @@ -1255,9 +1270,13 @@ coff_write_symbols (abfd) } else if (c_symbol->native->u.syment.n_sclass == C_FILE && c_symbol->native->u.syment.n_numaux > 0) - maxlen = bfd_coff_filnmlen (abfd); + { + if (bfd_coff_force_symnames_in_strings (abfd)) + bfd_write (".file", 1, 6, abfd); + maxlen = bfd_coff_filnmlen (abfd); + } else - maxlen = SYMNMLEN; + maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; if (name_length > maxlen) { diff --git a/bfd/coffswap.h b/bfd/coffswap.h index d7d090f..5bf011e 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -168,12 +168,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GET_SCNHDR_NRELOC #define GET_SCNHDR_NRELOC bfd_h_get_16 #endif +#ifndef MAX_SCNHDR_NRELOC +#define MAX_SCNHDR_NRELOC 0xffff +#endif #ifndef PUT_SCNHDR_NRELOC #define PUT_SCNHDR_NRELOC bfd_h_put_16 #endif #ifndef GET_SCNHDR_NLNNO #define GET_SCNHDR_NLNNO bfd_h_get_16 #endif +#ifndef MAX_SCNHDR_NLNNO +#define MAX_SCNHDR_NLNNO 0xffff +#endif #ifndef PUT_SCNHDR_NLNNO #define PUT_SCNHDR_NLNNO bfd_h_put_16 #endif @@ -184,6 +190,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PUT_SCNHDR_FLAGS bfd_h_put_32 #endif +#ifndef GET_RELOC_VADDR +#define GET_RELOC_VADDR bfd_h_get_32 +#endif +#ifndef PUT_RELOC_VADDR +#define PUT_RELOC_VADDR bfd_h_put_32 +#endif static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR)); static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); @@ -217,7 +229,7 @@ coff_swap_reloc_in (abfd, src, dst) RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); + reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, (bfd_byte *)reloc_src->r_vaddr); reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); #ifdef RS6000COFF_C @@ -241,7 +253,7 @@ coff_swap_reloc_out (abfd, src, dst) { struct internal_reloc *reloc_src = (struct internal_reloc *)src; struct external_reloc *reloc_dst = (struct external_reloc *)dst; - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); + PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); #ifdef RS6000COFF_C @@ -439,28 +451,6 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) } goto end; - /* RS/6000 "csect" auxents */ -#ifdef RS6000COFF_C - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - in->x_csect.x_scnlen.l = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); - in->x_csect.x_parmhash = bfd_h_get_32 (abfd, - ext->x_csect.x_parmhash); - in->x_csect.x_snhash = bfd_h_get_16 (abfd, 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. */ - in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); - in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); - in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); - in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); - goto end; - } - break; -#endif - case C_STAT: #ifdef C_LEAFSTAT case C_LEAFSTAT: @@ -558,27 +548,6 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) } goto end; -#ifdef RS6000COFF_C - /* 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; -#endif - case C_STAT: #ifdef C_LEAFSTAT case C_LEAFSTAT: @@ -705,7 +674,11 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) #ifdef RS6000COFF_C +#ifdef XCOFF64 + aouthdr_int->o_toc = bfd_h_get_64(abfd, aouthdr_ext->o_toc); +#else aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc); +#endif aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry); aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext); aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata); @@ -716,9 +689,14 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata); aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype); +#ifdef XCOFF64 + aouthdr_int->o_maxstack = bfd_h_get_64(abfd, aouthdr_ext->o_maxstack); + aouthdr_int->o_maxdata = bfd_h_get_64(abfd, aouthdr_ext->o_maxdata); +#else aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata); #endif +#endif #ifdef MIPSECOFF aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start); @@ -763,7 +741,11 @@ coff_swap_aouthdr_out (abfd, in, out) #endif #ifdef RS6000COFF_C +#ifdef XCOFF64 + bfd_h_put_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); +#else bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); +#endif bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry); bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext); bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata); @@ -774,9 +756,18 @@ coff_swap_aouthdr_out (abfd, in, out) bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata); bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype); bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype); +#ifdef XCOFF64 + bfd_h_put_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); + bfd_h_put_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); +#else bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); +#endif memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2); +#ifdef XCOFF64 + memset (aouthdr_out->o_debugger, 0, sizeof aouthdr_out->o_debugger); + memset (aouthdr_out->o_resv3, 0, sizeof aouthdr_out->o_resv3); +#endif #endif #ifdef MIPSECOFF @@ -879,8 +870,9 @@ coff_swap_scnhdr_out (abfd, in, out) PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); #else - if (scnhdr_int->s_nlnno <= 0xffff) - PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); + if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO) + PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno, + (bfd_byte *) scnhdr_ext->s_nlnno); else { char buf[sizeof (scnhdr_int->s_name) + 1]; @@ -891,10 +883,11 @@ coff_swap_scnhdr_out (abfd, in, out) (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"), bfd_get_filename (abfd), buf, scnhdr_int->s_nlnno); - PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); + PUT_SCNHDR_NLNNO(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); } - if (scnhdr_int->s_nreloc <= 0xffff) - PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); + if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC) + PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc, + (bfd_byte *) scnhdr_ext->s_nreloc); else { char buf[sizeof (scnhdr_int->s_name) + 1]; @@ -905,7 +898,7 @@ coff_swap_scnhdr_out (abfd, in, out) bfd_get_filename (abfd), buf, scnhdr_int->s_nreloc); bfd_set_error (bfd_error_file_truncated); - PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); + PUT_SCNHDR_NRELOC(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); ret = 0; } #endif diff --git a/bfd/config.bfd b/bfd/config.bfd index def3df0..cca93c8 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -42,7 +42,7 @@ m88*) targ_archs=bfd_m88k_arch ;; mips*) targ_archs=bfd_mips_arch ;; pj*) targ_archs="bfd_pj_arch bfd_i386_arch";; powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; -rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; +rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_64_arch bfd_powerpc_arch" ;; sparc*) targ_archs=bfd_sparc_arch ;; v850*) targ_archs=bfd_v850_arch ;; z8k*) targ_archs=bfd_z8k_arch ;; @@ -628,6 +628,7 @@ case "${targ}" in powerpc-*-aix* | powerpc-*-beos*) targ_defvec=rs6000coff_vec + targ_selvecs="rs6000coff64_vec" ;; powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ diff --git a/bfd/configure b/bfd/configure index 779e749..9f1425e 100755 --- a/bfd/configure +++ b/bfd/configure @@ -1845,7 +1845,7 @@ else if { (eval echo configure:1846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -5206,6 +5206,8 @@ do mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;; nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo" + target64=true ;; nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo" target64=true ;; @@ -5334,17 +5336,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5338: checking for $ac_hdr" >&5 +echo "configure:5340: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5343 "configure" +#line 5345 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5373,12 +5375,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5377: checking for $ac_func" >&5 +echo "configure:5379: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5382 "configure" +#line 5384 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5401,7 +5403,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5426,7 +5428,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:5430: checking for working mmap" >&5 +echo "configure:5432: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5434,7 +5436,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 5438 "configure" +#line 5440 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -5574,7 +5576,7 @@ main() } EOF -if { (eval echo configure:5578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -5599,12 +5601,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5603: checking for $ac_func" >&5 +echo "configure:5605: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5608 "configure" +#line 5610 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5627,7 +5629,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 8dbd9bb..c87197d 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -574,6 +574,8 @@ do mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;; nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo" + target64=true ;; nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo" target64=true ;; diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c index 11f0f80..a2c8f59 100644 --- a/bfd/cpu-powerpc.c +++ b/bfd/cpu-powerpc.c @@ -103,6 +103,20 @@ static const bfd_arch_info_type arch_info_struct[] = false, /* not the default */ powerpc_compatible, bfd_default_scan, + &arch_info_struct[4] + }, + { + 32, /* 32 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + 620, /* for the mpc620 */ + "powerpc", + "powerpc:620", + 3, + false, /* not the default */ + powerpc_compatible, + bfd_default_scan, 0 } }; diff --git a/bfd/libcoff.h b/bfd/libcoff.h index bee4ce9..a81fe68 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -713,6 +713,8 @@ typedef struct boolean _bfd_coff_long_filenames; boolean _bfd_coff_long_section_names; unsigned int _bfd_coff_default_section_alignment_power; + boolean _bfd_coff_force_symnames_in_strings; + unsigned int _bfd_coff_debug_string_prefix_length; void (*_bfd_coff_swap_filehdr_in) PARAMS (( bfd *abfd, PTR ext, @@ -910,6 +912,12 @@ typedef struct #define bfd_coff_symname_in_debug(abfd, sym)\ ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) +#define bfd_coff_force_symnames_in_strings(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) + +#define bfd_coff_debug_string_prefix_length(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) + #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ (abfd, file, base, symbol, aux, indaux)) diff --git a/bfd/reloc.c b/bfd/reloc.c index 12f07b6..7e1dd87 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -729,6 +729,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 + && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0 && strcmp (abfd->xvec->name, "xcoff-powermac") != 0 && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) @@ -1125,6 +1126,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 + && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0 && strcmp (abfd->xvec->name, "xcoff-powermac") != 0 && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) diff --git a/bfd/targets.c b/bfd/targets.c index 8b3a0e1..c481b2b 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -614,6 +614,7 @@ extern const bfd_target ppcboot_vec; extern const bfd_target riscix_vec; extern const bfd_target pmac_xcoff_vec; extern const bfd_target rs6000coff_vec; +extern const bfd_target rs6000coff64_vec; extern const bfd_target shcoff_vec; extern const bfd_target shlcoff_vec; extern const bfd_target shcoff_small_vec; @@ -867,6 +868,7 @@ const bfd_target * const bfd_target_vector[] = { &pmac_xcoff_vec, #endif &rs6000coff_vec, + &rs6000coff64_vec, &ppcboot_vec, &shcoff_vec, &shlcoff_vec, diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 3f488d7..17517b0 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ whole approach. */ #define XCOFF_XVECP(xv) \ (strcmp ((xv)->name, "aixcoff-rs6000") == 0 \ + || strcmp ((xv)->name, "aixcoff64-rs6000") == 0 \ || strcmp ((xv)->name, "xcoff-powermac") == 0) /* Get the XCOFF hash table entries for a BFD. */ |