patches/gcc/3.3.1/sh-pic-set_fpscr.patch
changeset 301 2be7232a73ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.3.1/sh-pic-set_fpscr.patch	Sat Jul 28 21:34:41 2007 +0000
     1.3 @@ -0,0 +1,61 @@
     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 +-------------
    1.10 +
    1.11 +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp>
    1.12 +To: dank@kegel.com
    1.13 +Cc: linux-sh@m17n.org
    1.14 +Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
    1.15 + with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
    1.16 +In-Reply-To: Your message of "Wed, 30 Jul 2003 11:20:49 +0900"
    1.17 +	<200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
    1.18 +References: <200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
    1.19 +Date: Wed, 30 Jul 2003 12:03:01 +0900
    1.20 +From: kaz Kojima <kkojima@rr.iij4u.or.jp>
    1.21 +
    1.22 +> I'll try to write the PIC version of it,
    1.23 +
    1.24 +Dan, does the attached patch work for you?
    1.25 +
    1.26 +[dank: original patch deleted; here's same thing rediffed against gcc-3.3 instead of HEAD]
    1.27 +
    1.28 +--- gcc-3.3/gcc/config/sh/lib1funcs.asm.old	Tue Jul 29 21:37:29 2003
    1.29 ++++ gcc-3.3/gcc/config/sh/lib1funcs.asm	Tue Jul 29 21:40:58 2003
    1.30 +@@ -1792,7 +1792,17 @@
    1.31 + 	.global GLOBAL(set_fpscr)
    1.32 + GLOBAL(set_fpscr):
    1.33 + 	lds r4,fpscr
    1.34 ++#ifdef __PIC__
    1.35 ++	mov.l	r12,@-r15
    1.36 ++	mova	LOCAL(set_fpscr_L0),r0
    1.37 ++	mov.l	LOCAL(set_fpscr_L0),r12
    1.38 ++	add	r0,r12
    1.39 ++	mov.l	LOCAL(set_fpscr_L1),r0
    1.40 ++	mov.l	@(r0,r12),r1
    1.41 ++	mov.l	@r15+,r12
    1.42 ++#else
    1.43 + 	mov.l LOCAL(set_fpscr_L1),r1
    1.44 ++#endif
    1.45 + 	swap.w r4,r0
    1.46 + 	or #24,r0
    1.47 + #ifndef FMOVD_WORKS
    1.48 +@@ -1820,8 +1830,16 @@
    1.49 + 	mov.l r3,@(4,r1)
    1.50 + #endif
    1.51 + 	.align 2
    1.52 ++#ifdef __PIC__
    1.53 ++LOCAL(set_fpscr_L0):
    1.54 ++	.long _GLOBAL_OFFSET_TABLE_
    1.55 ++LOCAL(set_fpscr_L1):
    1.56 ++	.long GLOBAL(fpscr_values@GOT)
    1.57 ++#else
    1.58 + LOCAL(set_fpscr_L1):
    1.59 + 	.long GLOBAL(fpscr_values)
    1.60 ++#endif
    1.61 ++
    1.62 + #ifdef __ELF__
    1.63 +         .comm   GLOBAL(fpscr_values),8,4
    1.64 + #else