[committed] v850 patch for lib1funcs.asm bug

James E Wilson wilson@specifix.com
Wed Aug 17 22:42:00 GMT 2005


This fixes a problem originally reported to the binutils list
    http://sourceware.org/ml/binutils/2005-08/msg00203.html
with the patch posted to the gcc list
    http://gcc.gnu.org/ml/gcc/2005-08/msg00443.html

Compiling a function that uses the interrupt_handler attribute with
-mv850e results in a linker error for relocation overflow.  The problem
is a .text in the v850 lib1funcs.asm that should be .call_table_text
instead.  But by rearranging the code a little, we can eliminate the
need for a section directive here.  Also, this fixes some comment
typos.  I fixed two more comment typos, but otherwise did not change the
patch.

I tested this with a v850-elf cross compiler build, reproduced the
original problem, and verified that the patch fixes it.

I have added the patch to mainline.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-08-17  Erik Christiansen  <erik@dd.nec.com.au>
	
	* config/v850/lib1funcs.asm (callt_save_interrupt): Fix comment typos.
	Move call_table_data to end.  Delete spurious .text.
	(callt_save_all_interrupt): Fix comment typo.

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/lib1funcs.asm,v
retrieving revision 1.18
diff -p -p -r1.18 lib1funcs.asm
*** lib1funcs.asm	25 Jun 2005 01:22:36 -0000	1.18
--- lib1funcs.asm	17 Aug 2005 22:12:42 -0000
*************** __callt_save_r6_r9:	.short ctoff(.L_save
*** 1428,1434 ****
  
  	
  #ifdef	L_callt_save_interrupt
! 	/* Put this functions into the call table area */
  	.call_table_text
  	
  	/* Save registers r1, ep, gp, r10 on stack and load up with expected values.  */
--- 1428,1434 ----
  
  	
  #ifdef	L_callt_save_interrupt
! 	/* Put these functions into the call table area.  */
  	.call_table_text
  	
  	/* Save registers r1, ep, gp, r10 on stack and load up with expected values.  */
*************** __callt_save_r6_r9:	.short ctoff(.L_save
*** 1440,1462 ****
          st.w    ep,  0[sp]
          st.w    gp,  4[sp]
          st.w    r1,  8[sp]
!         /* R10 has alread been saved bofore callt ctoff(_save_interrupt).  */
          /* st.w    r10, 12[sp]  */
  	mov	hilo(__ep),ep
  	mov	hilo(__gp),gp
  	ctret
  
-         /* Place the offsets of the start of the routine into the call table.  */
-         .call_table_data
-         .global __callt_save_interrupt
-         .type   __callt_save_interrupt,@function
- __callt_save_interrupt: .short ctoff(.L_save_interrupt)
- 
-         .call_table_text
- 
  	/* Restore saved registers, deallocate stack and return from the interrupt.  */
!         /* Called via:  callt ctoff(__callt_restore_itnerrupt).  */
! 	.text
  	.align	2
  	.globl	__return_interrupt
  	.type	__return_interrupt,@function
--- 1440,1453 ----
          st.w    ep,  0[sp]
          st.w    gp,  4[sp]
          st.w    r1,  8[sp]
!         /* R10 has already been saved before callt ctoff(_save_interrupt).  */
          /* st.w    r10, 12[sp]  */
  	mov	hilo(__ep),ep
  	mov	hilo(__gp),gp
  	ctret
  
  	/* Restore saved registers, deallocate stack and return from the interrupt.  */
!         /* Called via:  callt ctoff(__callt_restore_interrupt).  */
  	.align	2
  	.globl	__return_interrupt
  	.type	__return_interrupt,@function
*************** __callt_save_interrupt: .short ctoff(.L_
*** 1472,1480 ****
          addi    24, sp, sp
          reti
  
! 	/* Place the offsets of the start of the routine into the call table.  */
  	.call_table_data
  
          .global __callt_return_interrupt
          .type   __callt_return_interrupt,@function
  __callt_return_interrupt:       .short ctoff(.L_return_interrupt)
--- 1463,1475 ----
          addi    24, sp, sp
          reti
  
! 	/* Place the offsets of the start of these routines into the call table.  */
  	.call_table_data
  
+         .global __callt_save_interrupt
+         .type   __callt_save_interrupt,@function
+ __callt_save_interrupt:         .short ctoff(.L_save_interrupt)
+ 
          .global __callt_return_interrupt
          .type   __callt_return_interrupt,@function
  __callt_return_interrupt:       .short ctoff(.L_return_interrupt)
*************** __callt_return_interrupt:       .short c
*** 1482,1488 ****
  #endif /* L_callt_save_interrupt */
  
  #ifdef L_callt_save_all_interrupt
! 	/* Put this functions into the call table area.  */
  	.call_table_text
  	
  	/* Save all registers except for those saved in __save_interrupt.  */
--- 1477,1483 ----
  #endif /* L_callt_save_interrupt */
  
  #ifdef L_callt_save_all_interrupt
! 	/* Put these functions into the call table area.  */
  	.call_table_text
  	
  	/* Save all registers except for those saved in __save_interrupt.  */


More information about the Gcc-patches mailing list