patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,67 @@
     1.4 +See http://gcc.gnu.org/PR11901
     1.5 +Should fix
     1.6 +make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 
     1.7 +in glibc's "make tests".
     1.8 +
     1.9 +Note: this patch is named
    1.10 +sh-pic-set_fpscr-gcc-3.3.2.patch
    1.11 +and must be applied after 
    1.12 +sh-lib1funcs_sizeAndType.patch
    1.13 +but that'll happen naturally if you apply them in alphabetical order.
    1.14 +
    1.15 +-------------
    1.16 +
    1.17 +Date: Wed, 30 Jul 2003 12:03:01 +0900
    1.18 +From: kaz Kojima <kkojima@rr.iij4u.or.jp>
    1.19 +Subject: [linux-sh:02916] Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
    1.20 + with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
    1.21 +To: dank@kegel.com
    1.22 +Cc: linux-sh@m17n.org
    1.23 +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp>
    1.24 +
    1.25 +> I'll try to write the PIC version of it,
    1.26 +
    1.27 +Dan, does the attached patch work for you?
    1.28 +
    1.29 +Regards,
    1.30 +	kaz
    1.31 +--
    1.32 +diff -u3prN ORIG/gcc/gcc/config/sh/lib1funcs.asm LOCAL/gcc/gcc/config/sh/lib1funcs.asm
    1.33 +--- ORIG/gcc/gcc/config/sh/lib1funcs.asm	Thu Jun 19 07:38:59 2003
    1.34 ++++ gcc-3.3.2/gcc/config/sh/lib1funcs.asm	Wed Jul 30 11:08:49 2003
    1.35 +@@ -1936,7 +1944,17 @@ GLOBAL(moddi3):
    1.36 + 	FUNC(GLOBAL(set_fpscr))
    1.37 + GLOBAL(set_fpscr):
    1.38 + 	lds r4,fpscr
    1.39 ++#ifdef __PIC__
    1.40 ++	mov.l	r12,@-r15
    1.41 ++	mova	LOCAL(set_fpscr_L0),r0
    1.42 ++	mov.l	LOCAL(set_fpscr_L0),r12
    1.43 ++	add	r0,r12
    1.44 ++	mov.l	LOCAL(set_fpscr_L1),r0
    1.45 ++	mov.l	@(r0,r12),r1
    1.46 ++	mov.l	@r15+,r12
    1.47 ++#else
    1.48 + 	mov.l LOCAL(set_fpscr_L1),r1
    1.49 ++#endif
    1.50 + 	swap.w r4,r0
    1.51 + 	or #24,r0
    1.52 + #ifndef FMOVD_WORKS
    1.53 +@@ -1964,8 +1982,15 @@ GLOBAL(set_fpscr):
    1.54 + 	mov.l r3,@(4,r1)
    1.55 + #endif
    1.56 + 	.align 2
    1.57 ++#ifdef __PIC__
    1.58 ++LOCAL(set_fpscr_L0):
    1.59 ++	.long _GLOBAL_OFFSET_TABLE_
    1.60 ++LOCAL(set_fpscr_L1):
    1.61 ++	.long GLOBAL(fpscr_values@GOT)
    1.62 ++#else
    1.63 + LOCAL(set_fpscr_L1):
    1.64 + 	.long GLOBAL(fpscr_values)
    1.65 ++#endif
    1.66 + 
    1.67 + 	ENDFUNC(GLOBAL(set_fpscr))
    1.68 + #ifndef NO_FPSCR_VALUES
    1.69 +
    1.70 +