mips16 & crtn.asm

Richard Sandiford rsandifo@redhat.com
Tue Jul 30 14:58:00 GMT 2002


Another problem with 64-bit mips16 code: crti.asm and crtn.asm
don't agree on where the return address should go, or how big it
is.  I think crti is right, so this patch changes crtn to match.

Tested by inspection of a mips16 o64 multilib.  Also tested on
mips-elf with the other patches I posted today.  OK to install?

Richard


	* config/mips/crtn.asm: Don't use __mips16 to determine the
	return-address offset.  Define RA to a suitable temporary
	register for the return address.

Index: config/mips/crtn.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/crtn.asm,v
retrieving revision 1.4
diff -c -d -p -r1.4 crtn.asm
*** config/mips/crtn.asm	7 Feb 2002 23:43:23 -0000	1.4
--- config/mips/crtn.asm	30 Jul 2002 20:14:50 -0000
***************
*** 1,39 ****
  /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
     Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
  
- 	.section .init,"ax",@progbits
  #ifdef	__mips16
! /* The mips16 uses $7 for a return address. We use that here too.  */
! 	lw	$7,20($sp)
! 	addu	$sp,$sp,32
! 
! 	j	$7
  #else
  #ifdef __mips64
! 	ld      $31,40($sp)
  	daddu	$sp,$sp,48
  #else
! 	lw	$31,20($sp)
  	addu	$sp,$sp,32
  #endif
! 	j	$31
! 
! #endif
  
  	.section .fini,"ax",@progbits
- #ifdef	__mips16
- /* The mips16 uses $7 for a return address. We use that here too.  */
- 	lw	$7,20($sp)
- 	addu	$sp,$sp,32
- 
- 	j	$7
- #else
  #ifdef	__mips64
! 	ld	$31,40($sp)
  	daddu	$sp,$sp,48
  #else
! 	lw	$31,20($sp)
  	addu	$sp,$sp,32
  #endif
! 	j	$31
! #endif
--- 1,29 ----
  /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
     Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
  
  #ifdef	__mips16
! #define RA $7
  #else
+ #define RA $31
+ #endif
+ 
+ 	.section .init,"ax",@progbits
  #ifdef __mips64
! 	ld      RA,40($sp)
  	daddu	$sp,$sp,48
  #else
! 	lw	RA,20($sp)
  	addu	$sp,$sp,32
  #endif
! 	j	RA
  
  	.section .fini,"ax",@progbits
  #ifdef	__mips64
! 	ld	RA,40($sp)
  	daddu	$sp,$sp,48
  #else
! 	lw	RA,20($sp)
  	addu	$sp,$sp,32
  #endif
! 	j	RA
! 



More information about the Gcc-patches mailing list