This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

PATCH: Support 64bit BFD and 64bit host for xtensa


On Sat, Apr 09, 2005 at 01:48:35PM -0700, H. J. Lu wrote:
> m68k and xtensa are failed to build with --enable-64-bit-bfd. This
> patch fixes it.
> 

It turns out that xtensa doesn't support 64bit BFD on 32bit host
nor 64bit host. xtensa passes pointer as int to frag_variant, where
it is stored as offsetT. This patch changes int to long.


H.J.
----
2005-04-10  H.J. Lu  <hongjiu.lu@intel.com>

	* frags.c (frag_variant): Change type of var from int to long.
	* frags.h (frag_variant): Updated.

	* config/tc-i960.c (get_cdisp): Updated call to frag_variant.
	* config/tc-m68hc11.c (build_jump_insn): Likewise.
	* config/tc-msp430.c (msp430_operands): Likewise.
	* config/tc-xtensa.c (xtensa_mark_literal_pool_location): Likewise.
	(xg_assemble_vliw_tokens): Likewise.

	* config/tc-xtensa.c (xg_translate_sysreg_op): Likewise.
	(xtensa_translate_old_userreg_ops): Likewise.
	(xtensa_find_unaligned_branch_targets): Likewise.
	(xtensa_find_unaligned_loops): Likewise.
	(xtensa_fix_close_loop_end_frags): Likewise.
	(relax_frag_add_nop): Likewise.
	(xtensa_move_literals): Likewise.

--- gas/config/tc-i960.c.64bit	2005-03-25 10:18:49.000000000 -0800
+++ gas/config/tc-i960.c	2005-04-10 09:21:12.216332749 -0700
@@ -599,7 +599,7 @@ get_cdisp (char *dispP, /* Displacement 
 	    {
 	      outP = frag_more (8);	/* Allocate worst-case storage.  */
 	      md_number_to_chars (outP, instr, 4);
-	      frag_variant (rs_machine_dependent, 4, 4, 1,
+	      frag_variant (rs_machine_dependent, 4, 4L, 1,
 			    adds (e), offs (e), outP);
 	    }
 	  else
--- gas/config/tc-m68hc11.c.64bit	2005-02-24 12:47:34.000000000 -0800
+++ gas/config/tc-m68hc11.c	2005-04-10 09:21:19.773352892 -0700
@@ -1685,7 +1685,7 @@ build_jump_insn (struct m68hc11_opcode *
 	  opcode = m68hc11_new_insn (3);
 	  number_to_chars_bigendian (opcode, code, 1);
 	  number_to_chars_bigendian (opcode + 1, 0, 1);
-	  frag_variant (rs_machine_dependent, 1, 1,
+	  frag_variant (rs_machine_dependent, 1, 1L,
                         ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF),
                         operands[0].exp.X_add_symbol, (offsetT) n,
                         opcode);
--- gas/config/tc-msp430.c.64bit	2005-02-24 12:47:35.000000000 -0800
+++ gas/config/tc-msp430.c	2005-04-10 09:21:31.924777316 -0700
@@ -1695,7 +1695,7 @@ msp430_operands (struct msp430_opcode_s 
 
 	      frag = frag_more (8);
 	      bfd_putl16 ((bfd_vma) rc.sop, frag);
-	      frag = frag_variant (rs_machine_dependent, 8, 2,
+	      frag = frag_variant (rs_machine_dependent, 8, 2L,
 				   ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess.  */
 				   exp.X_add_symbol,
 				   0,	/* Offset is zero if jump dist less than 1K.  */
@@ -1727,7 +1727,7 @@ msp430_operands (struct msp430_opcode_s 
 	      frag = frag_more (8);
 	      bfd_putl16 ((bfd_vma) hc.op0, frag);
 	      bfd_putl16 ((bfd_vma) hc.op1, frag+2);
-	      frag = frag_variant (rs_machine_dependent, 8, 2,
+	      frag = frag_variant (rs_machine_dependent, 8, 2L,
 				   ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess.  */
 				   exp.X_add_symbol,
 				   0,	/* Offset is zero if jump dist less than 1K.  */
--- gas/config/tc-xtensa.c.64bit	2005-04-09 13:58:23.000000000 -0700
+++ gas/config/tc-xtensa.c	2005-04-10 09:19:57.993956558 -0700
@@ -2247,7 +2247,7 @@ xg_translate_sysreg_op (char **popname, 
       if (sr == XTENSA_UNDEFINED)
 	{
 	  as_bad (_("invalid register number (%ld) for '%s' instruction"),
-		  val, opname);
+		  (long) val, opname);
 	  return -1;
 	}
     }
@@ -2316,7 +2316,7 @@ xtensa_translate_old_userreg_ops (char *
       if (sr == XTENSA_UNDEFINED)
 	{
 	  as_bad (_("invalid register number (%ld) for '%s'"),
-		  val, opname);
+		  (long) val, opname);
 	  return -1;
 	}
     }
@@ -4650,10 +4650,10 @@ xtensa_mark_literal_pool_location (void)
      frchain's fix list.  We can use fr_var because fr_var's
      interpretation depends solely on the fr_type and subtype.  */
   pool_location = frag_now;
-  frag_variant (rs_machine_dependent, 0, (int) frchain_now,
+  frag_variant (rs_machine_dependent, 0, (long) frchain_now,
 		RELAX_LITERAL_POOL_BEGIN, NULL, 0, NULL);
   xtensa_set_frag_assembly_state (frag_now);
-  frag_variant (rs_machine_dependent, 0, (int) now_seg,
+  frag_variant (rs_machine_dependent, 0, (long) now_seg,
 		RELAX_LITERAL_POOL_END, NULL, 0, NULL);
   xtensa_set_frag_assembly_state (frag_now);
 
@@ -4882,7 +4882,7 @@ xtensa_find_unaligned_branch_targets (bf
 	      if (frag_addr + op_size > branch_align)
 		as_warn_where (frag->fr_file, frag->fr_line,
 			       _("unaligned branch target: %d bytes at 0x%lx"),
-			       op_size, frag->fr_address);
+			       op_size, (long) frag->fr_address);
 	    }
 	  frag = frag->fr_next;
 	}
@@ -4921,7 +4921,7 @@ xtensa_find_unaligned_loops (bfd *abfd A
 	      if (frag_addr + op_size > xtensa_fetch_width)
 		as_warn_where (frag->fr_file, frag->fr_line,
 			       _("unaligned loop: %d bytes at 0x%lx"),
-			       op_size, frag->fr_address);
+			       op_size, (long) frag->fr_address);
 	    }
 	  frag = frag->fr_next;
 	}
@@ -6890,7 +6890,7 @@ xg_assemble_vliw_tokens (vliw_insn *vins
   if (finish_frag)
     {
       frag_variant (rs_machine_dependent,
-		    extra_space, extra_space, RELAX_SLOTS,
+		    extra_space, (long) extra_space, RELAX_SLOTS,
 		    frag_now->fr_symbol, frag_now->fr_offset, f);
       xtensa_set_frag_assembly_state (frag_now);
     }
@@ -7462,7 +7462,7 @@ xtensa_fix_close_loop_end_frags (void)
 			  
 			  if (fragP->fr_var < length)
 			    as_fatal (_("fr_var %lu < length %d"),
-				      fragP->fr_var, length);
+				      (long) fragP->fr_var, length);
 			  else
 			    {
 			      assemble_nop (length,
@@ -8410,7 +8410,8 @@ relax_frag_add_nop (fragS *fragP)
 
   if (fragP->fr_var < length)
     {
-      as_fatal (_("fr_var (%ld) < length (%d)"), fragP->fr_var, length);
+      as_fatal (_("fr_var (%ld) < length (%d)"),
+		(long) fragP->fr_var, length);
       return 0;
     }
 
@@ -9872,14 +9873,14 @@ xtensa_move_literals (void)
 	      /* Note that we set this fr_var to be a fix
 		 chain when we created the literal pool location
 		 as RELAX_LITERAL_POOL_BEGIN.  */
-	      frchain_to = (frchainS *) literal_pool->fr_var;
+	      frchain_to = (frchainS *) (unsigned long) literal_pool->fr_var;
 	    }
 	  insert_after = literal_pool;
 
 	  while (insert_after->fr_next->fr_subtype != RELAX_LITERAL_POOL_END)
 	    insert_after = insert_after->fr_next;
 
-	  dest_seg = (segT) insert_after->fr_next->fr_var;
+	  dest_seg = (segT) (unsigned long) insert_after->fr_next->fr_var;
 
 	  *frag_splice = next_frag;
 	  search_frag->fr_next = insert_after->fr_next;
--- gas/frags.c.64bit	2005-03-03 08:56:17.000000000 -0800
+++ gas/frags.c	2005-04-10 09:18:02.244964784 -0700
@@ -226,7 +226,7 @@ frag_var (relax_stateT type, int max_cha
 	No call to frag_grow is done.  */
 
 char *
-frag_variant (relax_stateT type, int max_chars, int var,
+frag_variant (relax_stateT type, int max_chars, long var,
 	      relax_substateT subtype, symbolS *symbol, offsetT offset,
 	      char *opcode)
 {
--- gas/frags.h.64bit	2005-03-03 08:56:17.000000000 -0800
+++ gas/frags.h	2005-04-10 09:18:31.282199763 -0700
@@ -136,7 +136,7 @@ int frag_room (void);
 
 char *frag_variant (relax_stateT type,
 		    int max_chars,
-		    int var,
+		    long var,
 		    relax_substateT subtype,
 		    symbolS * symbol,
 		    offsetT offset,


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