patches/gcc/3.3/sh-pic-set_fpscr.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
Should fix
yann@1
     2
make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 
yann@1
     3
in glibc's "make tests".
yann@1
     4
yann@1
     5
-------------
yann@1
     6
yann@1
     7
Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp>
yann@1
     8
To: dank@kegel.com
yann@1
     9
Cc: linux-sh@m17n.org
yann@1
    10
Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
yann@1
    11
 with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
yann@1
    12
In-Reply-To: Your message of "Wed, 30 Jul 2003 11:20:49 +0900"
yann@1
    13
	<200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
yann@1
    14
References: <200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
yann@1
    15
Date: Wed, 30 Jul 2003 12:03:01 +0900
yann@1
    16
From: kaz Kojima <kkojima@rr.iij4u.or.jp>
yann@1
    17
yann@1
    18
> I'll try to write the PIC version of it,
yann@1
    19
yann@1
    20
Dan, does the attached patch work for you?
yann@1
    21
yann@1
    22
[dank: original patch deleted; here's same thing rediffed against gcc-3.3 instead of HEAD]
yann@1
    23
yann@1
    24
--- gcc-3.3/gcc/config/sh/lib1funcs.asm.old	Tue Jul 29 21:37:29 2003
yann@1
    25
+++ gcc-3.3/gcc/config/sh/lib1funcs.asm	Tue Jul 29 21:40:58 2003
yann@1
    26
@@ -1792,7 +1792,17 @@
yann@1
    27
 	.global GLOBAL(set_fpscr)
yann@1
    28
 GLOBAL(set_fpscr):
yann@1
    29
 	lds r4,fpscr
yann@1
    30
+#ifdef __PIC__
yann@1
    31
+	mov.l	r12,@-r15
yann@1
    32
+	mova	LOCAL(set_fpscr_L0),r0
yann@1
    33
+	mov.l	LOCAL(set_fpscr_L0),r12
yann@1
    34
+	add	r0,r12
yann@1
    35
+	mov.l	LOCAL(set_fpscr_L1),r0
yann@1
    36
+	mov.l	@(r0,r12),r1
yann@1
    37
+	mov.l	@r15+,r12
yann@1
    38
+#else
yann@1
    39
 	mov.l LOCAL(set_fpscr_L1),r1
yann@1
    40
+#endif
yann@1
    41
 	swap.w r4,r0
yann@1
    42
 	or #24,r0
yann@1
    43
 #ifndef FMOVD_WORKS
yann@1
    44
@@ -1820,8 +1830,16 @@
yann@1
    45
 	mov.l r3,@(4,r1)
yann@1
    46
 #endif
yann@1
    47
 	.align 2
yann@1
    48
+#ifdef __PIC__
yann@1
    49
+LOCAL(set_fpscr_L0):
yann@1
    50
+	.long _GLOBAL_OFFSET_TABLE_
yann@1
    51
+LOCAL(set_fpscr_L1):
yann@1
    52
+	.long GLOBAL(fpscr_values@GOT)
yann@1
    53
+#else
yann@1
    54
 LOCAL(set_fpscr_L1):
yann@1
    55
 	.long GLOBAL(fpscr_values)
yann@1
    56
+#endif
yann@1
    57
+
yann@1
    58
 #ifdef __ELF__
yann@1
    59
         .comm   GLOBAL(fpscr_values),8,4
yann@1
    60
 #else