diff options
author | Clinton Popetz <cpopetz@cpopetz.com> | 2000-04-26 15:09:44 +0000 |
---|---|---|
committer | Clinton Popetz <cpopetz@cpopetz.com> | 2000-04-26 15:09:44 +0000 |
commit | 7f6d05e83efe70ae5a029ca9bf76ce10a32b3b40 (patch) | |
tree | 8e599c994d0b9951b1177309cd8c2aa6f21abb73 /bfd/coffswap.h | |
parent | c13c43fdda3d022918e2ab2211caf52643eab25a (diff) | |
download | gdb-7f6d05e83efe70ae5a029ca9bf76ce10a32b3b40.zip gdb-7f6d05e83efe70ae5a029ca9bf76ce10a32b3b40.tar.gz gdb-7f6d05e83efe70ae5a029ca9bf76ce10a32b3b40.tar.bz2 |
Add XCOFF64 support.
bfd:
* 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.
gas:
* as.c (parse_args): Allow md_parse_option to override -a listing
option.
* config/obj-coff.c (add_lineno): Change type of offset parameter
from "int" to "bfd_vma."
* config/tc-ppc.c (md_pseudo_table): Add "llong" and "machine."
(ppc_mach, ppc_subseg_align, ppc_target_format): New.
(ppc_change_csect): Align correctly for XCOFF64.
(ppc_machine): New function, which discards "ppc_machine" line.
(ppc_tc): Cons for 8 when code is 64 bit.
(md_apply_fix3): Don't check operand->insert. Handle 64 bit
relocations.
(md_parse_option): Handle -a64 and -a32.
(ppc_xcoff64): New.
* config/tc-ppc.h (TARGET_MACH): Define.
(TARGET_FORMAT): Move to function.
(SUB_SEGMENT_ALIGN): Use ppc_subseg_align.
include:
* include/coff/rs6k64.h: New file.
opcodes:
* configure.in: Add bfd_powerpc_64_arch.
* disassemble.c (disassembler): Use print_insn_big_powerpc for
64 bit code.
Diffstat (limited to 'bfd/coffswap.h')
-rw-r--r-- | bfd/coffswap.h | 95 |
1 files changed, 44 insertions, 51 deletions
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 |