This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Patch: add .hidden directives to SH lib1funcs.asm


Here is a patch is to make all functions in lib1funcs of SH hidden to
prevent exporting these function from the shared libraries. If not,
sometimes executables call them via PLT which clobbers more registers
than expected.
This patch assumes the patch by Andrew Haley <aph@cambridge.redhat.com>
  http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01349.html
rewritten with macros. 
Regards,

	kaz
--
2001-10-02  kaz Kojima <kkojima@rr.iij4u.or.jp>

	* config/sh/lib1funcs.asm (all): Add .hidden attribute to
	functions.

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/lib1funcs.asm,v
retrieving revision 1.19
diff -u -r1.19 lib1funcs.asm
--- lib1funcs.asm	2001/06/03 22:08:26	1.19
+++ lib1funcs.asm	2001/10/02 02:45:55
@@ -39,8 +39,13 @@
 
 #ifdef __ELF__
 #define LOCAL(X) .L_##X
+#define FUNC(X) .type X,@function; .hidden X
+#define _ENDFUNC(X) .Lfe_##X: .size X,.Lfe_##X-X
+#define ENDFUNC(X) _ENDFUNC(X)
 #else
 #define LOCAL(X) L_##X
+#define FUNC(X)
+#define ENDFUNC(X)
 #endif
 
 #ifdef __linux__
@@ -86,6 +91,40 @@
 	.global	GLOBAL(ashiftrt_r4_31)
 	.global	GLOBAL(ashiftrt_r4_32)
 
+	FUNC(GLOBAL(ashiftrt_r4_0))
+	FUNC(GLOBAL(ashiftrt_r4_1))
+	FUNC(GLOBAL(ashiftrt_r4_2))
+	FUNC(GLOBAL(ashiftrt_r4_3))
+	FUNC(GLOBAL(ashiftrt_r4_4))
+	FUNC(GLOBAL(ashiftrt_r4_5))
+	FUNC(GLOBAL(ashiftrt_r4_6))
+	FUNC(GLOBAL(ashiftrt_r4_7))
+	FUNC(GLOBAL(ashiftrt_r4_8))
+	FUNC(GLOBAL(ashiftrt_r4_9))
+	FUNC(GLOBAL(ashiftrt_r4_10))
+	FUNC(GLOBAL(ashiftrt_r4_11))
+	FUNC(GLOBAL(ashiftrt_r4_12))
+	FUNC(GLOBAL(ashiftrt_r4_13))
+	FUNC(GLOBAL(ashiftrt_r4_14))
+	FUNC(GLOBAL(ashiftrt_r4_15))
+	FUNC(GLOBAL(ashiftrt_r4_16))
+	FUNC(GLOBAL(ashiftrt_r4_17))
+	FUNC(GLOBAL(ashiftrt_r4_18))
+	FUNC(GLOBAL(ashiftrt_r4_19))
+	FUNC(GLOBAL(ashiftrt_r4_20))
+	FUNC(GLOBAL(ashiftrt_r4_21))
+	FUNC(GLOBAL(ashiftrt_r4_22))
+	FUNC(GLOBAL(ashiftrt_r4_23))
+	FUNC(GLOBAL(ashiftrt_r4_24))
+	FUNC(GLOBAL(ashiftrt_r4_25))
+	FUNC(GLOBAL(ashiftrt_r4_26))
+	FUNC(GLOBAL(ashiftrt_r4_27))
+	FUNC(GLOBAL(ashiftrt_r4_28))
+	FUNC(GLOBAL(ashiftrt_r4_29))
+	FUNC(GLOBAL(ashiftrt_r4_30))
+	FUNC(GLOBAL(ashiftrt_r4_31))
+	FUNC(GLOBAL(ashiftrt_r4_32))
+
 	.align	1
 GLOBAL(ashiftrt_r4_32):
 GLOBAL(ashiftrt_r4_31):
@@ -165,6 +204,41 @@
 GLOBAL(ashiftrt_r4_0):
 	rts
 	nop
+
+	ENDFUNC(GLOBAL(ashiftrt_r4_0))
+	ENDFUNC(GLOBAL(ashiftrt_r4_1))
+	ENDFUNC(GLOBAL(ashiftrt_r4_2))
+	ENDFUNC(GLOBAL(ashiftrt_r4_3))
+	ENDFUNC(GLOBAL(ashiftrt_r4_4))
+	ENDFUNC(GLOBAL(ashiftrt_r4_5))
+	ENDFUNC(GLOBAL(ashiftrt_r4_6))
+	ENDFUNC(GLOBAL(ashiftrt_r4_7))
+	ENDFUNC(GLOBAL(ashiftrt_r4_8))
+	ENDFUNC(GLOBAL(ashiftrt_r4_9))
+	ENDFUNC(GLOBAL(ashiftrt_r4_10))
+	ENDFUNC(GLOBAL(ashiftrt_r4_11))
+	ENDFUNC(GLOBAL(ashiftrt_r4_12))
+	ENDFUNC(GLOBAL(ashiftrt_r4_13))
+	ENDFUNC(GLOBAL(ashiftrt_r4_14))
+	ENDFUNC(GLOBAL(ashiftrt_r4_15))
+	ENDFUNC(GLOBAL(ashiftrt_r4_16))
+	ENDFUNC(GLOBAL(ashiftrt_r4_17))
+	ENDFUNC(GLOBAL(ashiftrt_r4_18))
+	ENDFUNC(GLOBAL(ashiftrt_r4_19))
+	ENDFUNC(GLOBAL(ashiftrt_r4_20))
+	ENDFUNC(GLOBAL(ashiftrt_r4_21))
+	ENDFUNC(GLOBAL(ashiftrt_r4_22))
+	ENDFUNC(GLOBAL(ashiftrt_r4_23))
+	ENDFUNC(GLOBAL(ashiftrt_r4_24))
+	ENDFUNC(GLOBAL(ashiftrt_r4_25))
+	ENDFUNC(GLOBAL(ashiftrt_r4_26))
+	ENDFUNC(GLOBAL(ashiftrt_r4_27))
+	ENDFUNC(GLOBAL(ashiftrt_r4_28))
+	ENDFUNC(GLOBAL(ashiftrt_r4_29))
+	ENDFUNC(GLOBAL(ashiftrt_r4_30))
+	ENDFUNC(GLOBAL(ashiftrt_r4_31))
+	ENDFUNC(GLOBAL(ashiftrt_r4_32))
+
 #endif
 
 #ifdef L_ashiftrt_n
@@ -187,6 +261,7 @@
 !
 
 	.global	GLOBAL(ashrsi3)
+	FUNC(GLOBAL(ashrsi3))
 	.align	2
 GLOBAL(ashrsi3):
 	mov	#31,r0
@@ -314,6 +389,8 @@
 	rts
 	nop
 
+	ENDFUNC(GLOBAL(ashrsi3))
+
 #endif
 
 #ifdef L_ashiftlt
@@ -335,6 +412,7 @@
 ! (none)
 !
 	.global	GLOBAL(ashlsi3)
+	FUNC(GLOBAL(ashlsi3))
 	.align	2
 GLOBAL(ashlsi3):
 	mov	#31,r0
@@ -471,6 +549,8 @@
 	rts
 	nop
 
+	ENDFUNC(GLOBAL(ashlsi3))
+
 #endif
 
 #ifdef L_lshiftrt
@@ -492,6 +572,7 @@
 ! (none)
 !
 	.global	GLOBAL(lshrsi3)
+	FUNC(GLOBAL(lshrsi3))
 	.align	2
 GLOBAL(lshrsi3):
 	mov	#31,r0
@@ -628,6 +709,8 @@
 	rts
 	nop
 
+	ENDFUNC(GLOBAL(lshrsi3))
+
 #endif
 
 #ifdef L_movstr
@@ -644,76 +727,113 @@
 	add	#64,r4
 	.align	4
 	.global	GLOBAL(movstrSI64)
+	FUNC(GLOBAL(movstrSI64))
 GLOBAL(movstrSI64):
 	mov.l	@(60,r5),r0
 	mov.l	r0,@(60,r4)
 	.global	GLOBAL(movstrSI60)
+	FUNC(GLOBAL(movstrSI60))
 GLOBAL(movstrSI60):
 	mov.l	@(56,r5),r0
 	mov.l	r0,@(56,r4)
 	.global	GLOBAL(movstrSI56)
+	FUNC(GLOBAL(movstrSI56))
 GLOBAL(movstrSI56):
 	mov.l	@(52,r5),r0
 	mov.l	r0,@(52,r4)
 	.global	GLOBAL(movstrSI52)
+	FUNC(GLOBAL(movstrSI52))
 GLOBAL(movstrSI52):
 	mov.l	@(48,r5),r0
 	mov.l	r0,@(48,r4)
 	.global	GLOBAL(movstrSI48)
+	FUNC(GLOBAL(movstrSI48))
 GLOBAL(movstrSI48):
 	mov.l	@(44,r5),r0
 	mov.l	r0,@(44,r4)
 	.global	GLOBAL(movstrSI44)
+	FUNC(GLOBAL(movstrSI44))
 GLOBAL(movstrSI44):
 	mov.l	@(40,r5),r0
 	mov.l	r0,@(40,r4)
 	.global	GLOBAL(movstrSI40)
+	FUNC(GLOBAL(movstrSI40))
 GLOBAL(movstrSI40):
 	mov.l	@(36,r5),r0
 	mov.l	r0,@(36,r4)
 	.global	GLOBAL(movstrSI36)
+	FUNC(GLOBAL(movstrSI36))
 GLOBAL(movstrSI36):
 	mov.l	@(32,r5),r0
 	mov.l	r0,@(32,r4)
 	.global	GLOBAL(movstrSI32)
+	FUNC(GLOBAL(movstrSI32))
 GLOBAL(movstrSI32):
 	mov.l	@(28,r5),r0
 	mov.l	r0,@(28,r4)
 	.global	GLOBAL(movstrSI28)
+	FUNC(GLOBAL(movstrSI28))
 GLOBAL(movstrSI28):
 	mov.l	@(24,r5),r0
 	mov.l	r0,@(24,r4)
 	.global	GLOBAL(movstrSI24)
+	FUNC(GLOBAL(movstrSI24))
 GLOBAL(movstrSI24):
 	mov.l	@(20,r5),r0
 	mov.l	r0,@(20,r4)
 	.global	GLOBAL(movstrSI20)
+	FUNC(GLOBAL(movstrSI20))
 GLOBAL(movstrSI20):
 	mov.l	@(16,r5),r0
 	mov.l	r0,@(16,r4)
 	.global	GLOBAL(movstrSI16)
+	FUNC(GLOBAL(movstrSI16))
 GLOBAL(movstrSI16):
 	mov.l	@(12,r5),r0
 	mov.l	r0,@(12,r4)
 	.global	GLOBAL(movstrSI12)
+	FUNC(GLOBAL(movstrSI12))
 GLOBAL(movstrSI12):
 	mov.l	@(8,r5),r0
 	mov.l	r0,@(8,r4)
 	.global	GLOBAL(movstrSI8)
+	FUNC(GLOBAL(movstrSI8))
 GLOBAL(movstrSI8):
 	mov.l	@(4,r5),r0
 	mov.l	r0,@(4,r4)
 	.global	GLOBAL(movstrSI4)
+	FUNC(GLOBAL(movstrSI4))
 GLOBAL(movstrSI4):
 	mov.l	@(0,r5),r0
 	mov.l	r0,@(0,r4)
+	.global	GLOBAL(movstrSI0)
+	FUNC(GLOBAL(movstrSI0))
 GLOBAL(movstrSI0):
 	rts
 	nop
 
+	ENDFUNC(GLOBAL(movstrSI64))
+	ENDFUNC(GLOBAL(movstrSI60))
+	ENDFUNC(GLOBAL(movstrSI56))
+	ENDFUNC(GLOBAL(movstrSI52))
+	ENDFUNC(GLOBAL(movstrSI48))
+	ENDFUNC(GLOBAL(movstrSI44))
+	ENDFUNC(GLOBAL(movstrSI40))
+	ENDFUNC(GLOBAL(movstrSI36))
+	ENDFUNC(GLOBAL(movstrSI32))
+	ENDFUNC(GLOBAL(movstrSI28))
+	ENDFUNC(GLOBAL(movstrSI24))
+	ENDFUNC(GLOBAL(movstrSI20))
+	ENDFUNC(GLOBAL(movstrSI16))
+	ENDFUNC(GLOBAL(movstrSI12))
+	ENDFUNC(GLOBAL(movstrSI8))
+	ENDFUNC(GLOBAL(movstrSI4))
+	ENDFUNC(GLOBAL(movstrSI0))
+
 	.align	4
 
 	.global	GLOBAL(movstr)
+	FUNC(GLOBAL(movstr))
 GLOBAL(movstr):
 	mov.l	@(60,r5),r0
 	mov.l	r0,@(60,r4)
@@ -770,6 +890,8 @@
 	add	#64,r5
 	bra	GLOBAL(movstr)
 	add	#64,r4
+
+	FUNC(GLOBAL(movstr))
 #endif
 
 #ifdef L_movstr_i4
@@ -778,6 +900,10 @@
 	.global	GLOBAL(movstr_i4_odd)
 	.global	GLOBAL(movstrSI12_i4)
 
+	FUNC(GLOBAL(movstr_i4_even))
+	FUNC(GLOBAL(movstr_i4_odd))
+	FUNC(GLOBAL(movstrSI12_i4))
+
 	.p2align	5
 L_movstr_2mod4_end:
 	mov.l	r0,@(16,r4)
@@ -786,6 +912,11 @@
 
 	.p2align	2
 
+GLOBAL(movstr_i4_even):
+	mov.l	@r5+,r0
+	bra	L_movstr_start_even
+	mov.l	@r5+,r1
+
 GLOBAL(movstr_i4_odd):
 	mov.l	@r5+,r1
 	add	#-4,r4
@@ -812,10 +943,8 @@
 	rts
 	mov.l	r3,@(12,r4)
 
-GLOBAL(movstr_i4_even):
-	mov.l	@r5+,r0
-	bra	L_movstr_start_even
-	mov.l	@r5+,r1
+	ENDFUNC(GLOBAL(movstr_i4_even))
+	ENDFUNC(GLOBAL(movstr_i4_odd))
 
 	.p2align	4
 GLOBAL(movstrSI12_i4):
@@ -826,12 +955,16 @@
 	mov.l	r1,@(4,r4)
 	rts
 	mov.l	r2,@(8,r4)
+
+	ENDFUNC(GLOBAL(movstrSI12_i4))
+
 #endif
 
 #ifdef L_mulsi3
 
 
 	.global	GLOBAL(mulsi3)
+	FUNC(GLOBAL(mulsi3))
 
 ! r4 =       aabb
 ! r5 =       ccdd
@@ -864,7 +997,7 @@
 	rts
 	add	r2,r0
 
-
+	FUNC(GLOBAL(mulsi3))
 #endif
 #ifdef L_sdivsi3_i4
 	.title "SH DIVIDE"
@@ -873,6 +1006,7 @@
 !! args in r4 and r5, result in fpul, clobber dr0, dr2
 
 	.global	GLOBAL(sdivsi3_i4)
+	FUNC(GLOBAL(sdivsi3_i4))
 GLOBAL(sdivsi3_i4):
 	lds r4,fpul
 	float fpul,dr0
@@ -882,10 +1016,13 @@
 	rts
 	ftrc dr0,fpul
 
+	ENDFUNC(GLOBAL(sdivsi3_i4))
+
 #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
 !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2
 
 	.global	GLOBAL(sdivsi3_i4)
+	FUNC(GLOBAL(sdivsi3_i4))
 GLOBAL(sdivsi3_i4):
 	sts.l fpscr,@-r15
 	mov #8,r2
@@ -900,6 +1037,8 @@
 	rts
 	lds.l @r15+,fpscr
 
+	ENDFUNC(GLOBAL(sdivsi3_i4))
+
 #endif /* ! __SH4__ */
 #endif
 
@@ -913,9 +1052,10 @@
 !!
 !!
 
-!! args in r4 and r5, result in r0 clobber r1,r2,r3
+!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit
 
 	.global	GLOBAL(sdivsi3)
+	FUNC(GLOBAL(sdivsi3))
 GLOBAL(sdivsi3):
 	mov	r4,r1
 	mov	r5,r0
@@ -1000,6 +1140,8 @@
 div0:	rts
 	mov	#0,r0
 
+	ENDFUNC(GLOBAL(sdivsi3))
+
 #endif /* ! __SH4__ */
 #endif
 #ifdef L_udivsi3_i4
@@ -1007,9 +1149,11 @@
 	.title "SH DIVIDE"
 !! 4 byte integer Divide code for the Hitachi SH
 #ifdef __SH4__
-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
+!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,
+!! and t bit
 
 	.global	GLOBAL(udivsi3_i4)
+	FUNC(GLOBAL(udivsi3_i4))
 GLOBAL(udivsi3_i4):
 	mov #1,r1
 	cmp/hi r1,r5
@@ -1050,10 +1194,14 @@
 L1:
 	.double 2147483648
 
+	ENDFUNC(GLOBAL(udivsi3_i4))
+
 #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
+!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,
+!! and t bit
 
 	.global	GLOBAL(udivsi3_i4)
+	FUNC(GLOBAL(udivsi3_i4))
 GLOBAL(udivsi3_i4):
 	mov #1,r1
 	cmp/hi r1,r5
@@ -1102,6 +1250,8 @@
 #endif
 	.double 2147483648
 
+	ENDFUNC(GLOBAL(udivsi3_i4))
+
 #endif /* ! __SH4__ */
 #endif
 
@@ -1117,6 +1267,7 @@
 
 !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
 	.global	GLOBAL(udivsi3)
+	FUNC(GLOBAL(udivsi3))
 
 GLOBAL(udivsi3):
 longway:
@@ -1166,11 +1317,14 @@
 ret:	rts
 	mov	r4,r0
 
+	ENDFUNC(GLOBAL(udivsi3))
+
 #endif /* __SH4__ */
 #endif
 #ifdef L_set_fpscr
 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
 	.global GLOBAL(set_fpscr)
+	FUNC(GLOBAL(set_fpscr))
 GLOBAL(set_fpscr):
 	lds r4,fpscr
 	mov.l LOCAL(set_fpscr_L1),r1
@@ -1203,6 +1357,9 @@
 	.align 2
 LOCAL(set_fpscr_L1):
 	.long GLOBAL(fpscr_values)
+
+	ENDFUNC(GLOBAL(set_fpscr))
+
 #ifdef __ELF__
         .comm   GLOBAL(fpscr_values),8,4
 #else
@@ -1213,6 +1370,7 @@
 #ifdef L_ic_invalidate
 #if defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
 	.global GLOBAL(ic_invalidate)
+	FUNC(GLOBAL(ic_invalidate))
 GLOBAL(ic_invalidate):
 	ocbwb	@r4
 	mova	0f,r0
@@ -1235,5 +1393,8 @@
 	nop
 	.endr
 	.endr
+
+	ENDFUNC(GLOBAL(ic_invalidate))
+
 #endif /* SH4 */
 #endif /* L_ic_invalidate */


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