aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorClinton Popetz <cpopetz@cpopetz.com>2000-04-26 15:09:44 +0000
committerClinton Popetz <cpopetz@cpopetz.com>2000-04-26 15:09:44 +0000
commit7f6d05e83efe70ae5a029ca9bf76ce10a32b3b40 (patch)
tree8e599c994d0b9951b1177309cd8c2aa6f21abb73 /gas/config/tc-ppc.c
parentc13c43fdda3d022918e2ab2211caf52643eab25a (diff)
downloadgdb-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 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c68
1 files changed, 65 insertions, 3 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 365a535..cac5d6a 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -86,6 +86,7 @@ static void ppc_stabx PARAMS ((int));
static void ppc_rename PARAMS ((int));
static void ppc_toc PARAMS ((int));
static void ppc_xcoff_cons PARAMS ((int));
+static void ppc_machine PARAMS ((int));
static void ppc_vbyte PARAMS ((int));
#endif
@@ -182,9 +183,11 @@ const pseudo_typeS md_pseudo_table[] =
{ "text", ppc_section, 't' },
{ "toc", ppc_toc, 0 },
{ "long", ppc_xcoff_cons, 2 },
+ { "llong", ppc_xcoff_cons, 3 },
{ "word", ppc_xcoff_cons, 1 },
{ "short", ppc_xcoff_cons, 1 },
{ "vbyte", ppc_vbyte, 0 },
+ { "machine", ppc_machine, 0 },
#endif
#ifdef OBJ_ELF
@@ -591,6 +594,9 @@ static int ppc_cpu = 0;
PPC_OPCODE_32 or PPC_OPCODE_64. */
static unsigned long ppc_size = PPC_OPCODE_32;
+/* Whether to target xcoff64 */
+static int ppc_xcoff64 = 0;
+
/* Opcode hash table. */
static struct hash_control *ppc_hash;
@@ -740,6 +746,16 @@ md_parse_option (c, arg)
break;
#endif
+ /* a64 and a32 determine whether to use XCOFF64 or XCOFF32. */
+ case 'a':
+ if (strcmp (arg, "64") == 0)
+ ppc_xcoff64 = 1;
+ else if (strcmp (arg, "32") == 0)
+ ppc_xcoff64 = 0;
+ else
+ return 0;
+ break;
+
case 'm':
/* -mpwrx and -mpwr2 mean to assemble for the IBM POWER/2
(RIOS2). */
@@ -948,6 +964,37 @@ ppc_arch ()
return bfd_arch_unknown;
}
+unsigned long
+ppc_mach ()
+{
+ return (ppc_size == PPC_OPCODE_64) ? 620 : 0;
+}
+
+int
+ppc_subseg_align()
+{
+ return (ppc_xcoff64) ? 3 : 2;
+}
+
+extern char*
+ppc_target_format()
+{
+#ifdef OBJ_COFF
+#ifdef TE_PE
+ return (target_big_endian ? "pe-powerpc" : "pe-powerpcle");
+#elif TE_POWERMAC
+#else
+ return (ppc_xcoff64 ? "aixcoff64-rs6000" : "aixcoff-rs6000");
+#endif
+#ifdef TE_POWERMAC
+ return "xcoff-powermac";
+#endif
+#endif
+#ifdef OBJ_ELF
+ return (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle");
+#endif
+}
+
/* This function is called when the assembler starts up. It is called
after the options have been parsed and the output file has been
opened. */
@@ -2478,7 +2525,7 @@ ppc_change_csect (sym)
symbol_set_frag (sym, frag_now);
S_SET_VALUE (sym, (valueT) frag_now_fix ());
- symbol_get_tc (sym)->align = 2;
+ symbol_get_tc (sym)->align = (ppc_xcoff64) ? 3 : 2;
symbol_get_tc (sym)->output = 1;
symbol_get_tc (sym)->within = sym;
@@ -3150,6 +3197,14 @@ ppc_xcoff_cons (log_size)
}
static void
+ppc_machine(dummy)
+ int dummy;
+{
+ discard_rest_of_line();
+ /* What does aix use this for? */
+}
+
+static void
ppc_vbyte (dummy)
int dummy;
{
@@ -3269,7 +3324,7 @@ ppc_tc (ignore)
else
{
++input_line_pointer;
- cons (4);
+ cons ((ppc_size == PPC_OPCODE_64) ? 8 : 4);
}
}
@@ -4802,7 +4857,6 @@ md_apply_fix3 (fixp, valuep, seg)
else if ((operand->flags & PPC_OPERAND_PARENS) != 0
&& operand->bits == 16
&& operand->shift == 0
- && operand->insert == NULL
&& fixp->fx_addsy != NULL
&& ppc_is_toc_sym (fixp->fx_addsy))
{
@@ -4849,6 +4903,14 @@ md_apply_fix3 (fixp, valuep, seg)
value, 4);
break;
+ case BFD_RELOC_64:
+ if (fixp->fx_pcrel)
+ fixp->fx_r_type = BFD_RELOC_64_PCREL;
+ /* fall through */
+ case BFD_RELOC_64_PCREL:
+ md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ value, 8);
+ break;
case BFD_RELOC_LO16:
case BFD_RELOC_16:
case BFD_RELOC_GPREL16: