This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

XCOFF64 gas patch


Here are the random changes needed to make gas happy with ppc64 xcoff64 output.
There's also a change in here to make the disassembler pick the right
instruction set for this case.


					-Clint

gas/ChangeLog:

2000-04-10  Clinton Popetz  <cpopetz@cygnus.com>

	* 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, 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.
	* config/tc-ppc.h (TARGET_MACH): Define.
	(TARGET_FORMAT): Move to function.
	(SUB_SEGMENT_ALIGN): Use ppc_subseg_align.

opcodes/ChangeLog:

2000-04-10  Clinton Popetz  <cpopetz@cygnus.com>
	
	* disassemble.c (disassembler): For bfd_arch_rs6000, return
	print_insn_big_powerpc if bfd_get_mach says we are looking at
	64 bit code.

Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.22
diff -c -2 -p -r1.22 obj-coff.c
*** obj-coff.c	2000/02/22 07:50:13	1.22
--- obj-coff.c	2000/04/10 16:40:54
*************** static void
*** 430,434 ****
  add_lineno (frag, offset, num)
       fragS *frag;
!      int offset;
       int num;
  {
--- 430,434 ----
  add_lineno (frag, offset, num)
       fragS *frag;
!      bfd_vma offset;
       int num;
  {
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.9
diff -c -2 -p -r1.9 tc-ppc.c
*** tc-ppc.c	2000/04/02 06:27:51	1.9
--- tc-ppc.c	2000/04/10 16:40:57
*************** static void ppc_rename PARAMS ((int));
*** 87,90 ****
--- 87,91 ----
  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
*************** const pseudo_typeS md_pseudo_table[] =
*** 183,189 ****
--- 184,192 ----
    { "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
  
*************** ppc_arch ()
*** 949,952 ****
--- 952,986 ----
  }
  
+ unsigned long
+ ppc_mach ()
+ {
+   return (ppc_size == PPC_OPCODE_64) ? 620 : 0;
+ }
+ 
+ int
+ ppc_subseg_align()
+ {
+   return (ppc_size == PPC_OPCODE_64) ? 3 : 2;
+ }
+ 
+ extern char* 
+ target_format()
+ {
+ #ifdef OBJ_COFF
+ #ifdef TE_PE
+   return (target_big_endian ? "pe-powerpc" : "pe-powerpcle");
+ #elif TE_POWERMAC
+ #else
+   return (ppc_size == PPC_OPCODE_64) ? "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
*************** ppc_change_csect (sym)
*** 2479,2483 ****
        S_SET_VALUE (sym, (valueT) frag_now_fix ());
  
!       symbol_get_tc (sym)->align = 2;
        symbol_get_tc (sym)->output = 1;
        symbol_get_tc (sym)->within = sym;
--- 2513,2517 ----
        S_SET_VALUE (sym, (valueT) frag_now_fix ());
  
!       symbol_get_tc (sym)->align = (ppc_size == PPC_OPCODE_64) ? 3 : 2;
        symbol_get_tc (sym)->output = 1;
        symbol_get_tc (sym)->within = sym;
*************** ppc_xcoff_cons (log_size)
*** 3151,3154 ****
--- 3185,3195 ----
  
  static void
+ ppc_machine(dummy) 
+     int dummy;
+ {
+     discard_rest_of_line();
+ }
+ 
+ static void
  ppc_vbyte (dummy)
       int dummy;
*************** ppc_tc (ignore)
*** 3270,3274 ****
      {
        ++input_line_pointer;
!       cons (4);
      }
  }
--- 3311,3315 ----
      {
        ++input_line_pointer;
!       cons ((ppc_size == PPC_OPCODE_64) ? 8 : 4);
      }
  }
*************** md_apply_fix3 (fixp, valuep, seg)
*** 4803,4807 ****
  	       && operand->bits == 16
  	       && operand->shift == 0
! 	       && operand->insert == NULL
  	       && fixp->fx_addsy != NULL
  	       && ppc_is_toc_sym (fixp->fx_addsy))
--- 4844,4848 ----
  	       && operand->bits == 16
  	       && operand->shift == 0
! /*	       && operand->insert == NULL*/
  	       && fixp->fx_addsy != NULL
  	       && ppc_is_toc_sym (fixp->fx_addsy))
*************** md_apply_fix3 (fixp, valuep, seg)
*** 4850,4853 ****
--- 4891,4902 ----
  	  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:
Index: gas/config/tc-ppc.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.h,v
retrieving revision 1.5
diff -c -2 -p -r1.5 tc-ppc.h
*** tc-ppc.h	2000/01/31 19:13:47	1.5
--- tc-ppc.h	2000/04/10 16:40:57
*************** struct fix;
*** 48,52 ****
--- 48,54 ----
  /* The target BFD architecture.  */
  #define TARGET_ARCH (ppc_arch ())
+ #define TARGET_MACH (ppc_mach ())
  extern enum bfd_architecture ppc_arch PARAMS ((void));
+ extern unsigned long ppc_mach PARAMS ((void));
  
  /* Whether or not the target is big endian */
*************** extern int target_big_endian;
*** 54,76 ****
  
  /* The target BFD format.  */
! #ifdef OBJ_COFF
! #ifdef TE_PE
! #define TARGET_FORMAT (target_big_endian ? "pe-powerpc" : "pe-powerpcle")
! #else
! #define TARGET_FORMAT "aixcoff-rs6000"
! #endif
! #endif
! 
! /* PowerMac has a BFD slightly different from AIX's.  */
! #ifdef TE_POWERMAC
! #ifdef TARGET_FORMAT
! #undef TARGET_FORMAT
! #endif
! #define TARGET_FORMAT "xcoff-powermac"
! #endif
! 
! #ifdef OBJ_ELF
! #define TARGET_FORMAT (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle")
! #endif
  
  /* Permit temporary numeric labels.  */
--- 56,61 ----
  
  /* The target BFD format.  */
! #define TARGET_FORMAT target_format()
! extern char* target_format();
  
  /* Permit temporary numeric labels.  */
*************** extern void ppc_adjust_symtab PARAMS ((v
*** 187,191 ****
  
  /* Niclas Andersson <nican@ida.liu.se> says this is needed.  */
! #define SUB_SEGMENT_ALIGN(SEG) 2
  
  /* We also need to copy, in particular, the class of the symbol,
--- 172,177 ----
  
  /* Niclas Andersson <nican@ida.liu.se> says this is needed.  */
! extern int ppc_subseg_align PARAMS ((void));
! #define SUB_SEGMENT_ALIGN(SEG) ppc_subseg_align()
  
  /* We also need to copy, in particular, the class of the symbol,
Index: opcodes/disassemble.c
===================================================================
RCS file: /cvs/src/src/opcodes/disassemble.c,v
retrieving revision 1.8
diff -c -2 -p -r1.8 disassemble.c
*** disassemble.c	2000/04/02 06:26:09	1.8
--- disassemble.c	2000/04/10 16:40:57
*************** disassembler (abfd)
*** 211,215 ****
  #ifdef ARCH_rs6000
      case bfd_arch_rs6000:
!       disassemble = print_insn_rs6000;
        break;
  #endif
--- 211,218 ----
  #ifdef ARCH_rs6000
      case bfd_arch_rs6000:
!       if (bfd_get_mach (abfd) == 620)
! 	disassemble = print_insn_big_powerpc;
!       else
! 	disassemble = print_insn_rs6000;
        break;
  #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]