gas-950726/ss-950728/powerpc*-*-eabi: addis 9,0,a-400000@ha ???

Michael Meissner meissner@cygnus.com
Fri Aug 11 10:31:00 GMT 1995


| Hello,
| 
| 	c-torture-1.34/execute/index-1.c
| 
| from the lines:
| 
| 	int
| 	f (int n)
| 	{
| 	  return a[n - 100000];
| 	}
| 
| outputs the assembler:
| 
| 	addis 9,0,a-400000@ha
| 	addi 11,9,a-400000@l
| 
| quite simply, is this valid PowerPC assembler?  Gas doesn't think so:

This will be fixed in tonights fixes.  Here are the patches:

Fri Aug 11 13:23:56 1995  Michael Meissner  <meissner@cygnus.com>

	* write.h (struct fix): Add new field fx_no_overflow.

	* write.c (fixup_segment): If fx_no_overflow is non-zero, don't
	complain if the addend is too large.

	* config/tc-ppc.c (md_assemble): Set fx_no_overflow if the half
	word relocations BFD_RELOC_{LO16,HI16,HI16_S}.

*** write.h.~1~	Wed Jul 12 10:17:43 1995
--- write.h	Fri Aug 11 13:16:44 1995
*************** struct fix
*** 78,83 ****
--- 78,88 ----
    /* Has this relocation already been applied?  */
    unsigned fx_done : 1;
  
+   /* Suppress overflow complaints on large addends.  This is used
+      in the PowerPC ELF config to allow large addends on the
+      BFD_RELOC_{LO16,HI16,HI16_S} relocations.  */
+   unsigned fx_no_overflow : 1;
+ 
    /* How many bytes are involved? */
    short int fx_size;
  
*** write.c.~1~	Thu Aug 10 09:13:24 1995
--- write.c	Fri Aug 11 13:17:16 1995
*************** fixup_segment (fixP, this_segment_type)
*** 2391,2397 ****
  	    }
  	}
  
!       if (!fixP->fx_bit_fixP && size > 0)
  	{
  	  valueT mask = 0;
  	  if (size < sizeof (mask))
--- 2391,2397 ----
  	    }
  	}
  
!       if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
  	{
  	  valueT mask = 0;
  	  if (size < sizeof (mask))
*** config/tc-ppc.c.~1~	Fri Jul 21 23:10:32 1995
--- config/tc-ppc.c	Fri Aug 11 13:16:54 1995
*************** md_assemble (str)
*** 875,887 ****
  	  reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
  	  int size = (!reloc_howto) ? 0 : bfd_get_reloc_size (reloc_howto);
  	  int offset = target_big_endian ? (4 - size) : 0;
  
  	  if (size > 4)
  	    abort();
  
! 	  fix_new_exp (frag_now, f - frag_now->fr_literal + offset, size,
! 		       &fixups[i].exp, (reloc_howto && reloc_howto->pc_relative),
! 		       fixups[i].reloc);
  	}
        else
  	fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
--- 875,899 ----
  	  reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
  	  int size = (!reloc_howto) ? 0 : bfd_get_reloc_size (reloc_howto);
  	  int offset = target_big_endian ? (4 - size) : 0;
+ 	  fixS *fixP;
  
  	  if (size > 4)
  	    abort();
  
! 	  fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, size,
! 			      &fixups[i].exp, (reloc_howto && reloc_howto->pc_relative),
! 			      fixups[i].reloc);
! 
! 	  /* Turn off complaints that the addend is too large for things like
! 	     foo+100000@ha.  */
! 	  switch (fixups[i].reloc)
! 	    {
! 	    case BFD_RELOC_LO16:
! 	    case BFD_RELOC_HI16:
! 	    case BFD_RELOC_HI16_S:
! 	      fixP->fx_no_overflow = 1;
! 	      break;
! 	    }
  	}
        else
  	fix_new_exp (frag_now, f - frag_now->fr_literal, 4,

-- 
Michael Meissner, Cygnus Support (East Coast)
Suite 105, 48 Grove Street, Somerville, MA 02144, USA
meissner@cygnus.com,	617-629-3016 (office),	617-629-3010 (fax)




More information about the Gas2 mailing list