summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-04-25 22:45:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-04-25 22:45:27 +0000
commitf99a9da1a1cab12d6d21eca43fc6bc9cf8a8bc19 (patch)
treee08d179e9b1b96700e8b1b03715ce37753ae0367
parentf529c3452179c79a0d53992af2c2f13f3de8fdb0 (diff)
* PR target/11901
``[3.3 only] set_fpscr isn't PIC even when __PIC__ defined; bad for prelinking, causes glibc-3.2.3 check-textrel test to fail'' Correctly address fpscr_values[] in set_fpscr() when compiled PIC. This is a partial backport of this commit: 2003-08-11 Kaz Kojima <kkojima@gcc.gnu.org> * config/sh/lib1funcs.asm (__udivdi3): Add .type and .size information in SHmedia case too. (__divdi3, __umoddi3, __moddi3, __init_trampoline, __ic_invalidate): Likewise. (__set_fpscr): Use an access via GOT for PIC case.
-rw-r--r--gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm18
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm b/gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm
index 5047e607e60..91e03469c13 100644
--- a/gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm
+++ b/gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm
@@ -1895,7 +1895,17 @@ GLOBAL(moddi3):
FUNC(GLOBAL(set_fpscr),function)
GLOBAL(set_fpscr):
lds r4,fpscr
+#ifdef __PIC__
+ mov.l r12,@-r15
+ mova LOCAL(set_fpscr_L0),r0
+ mov.l LOCAL(set_fpscr_L0),r12
+ add r0,r12
+ mov.l LOCAL(set_fpscr_L1),r0
+ mov.l @(r0,r12),r1
+ mov.l @r15+,r12
+#else
mov.l LOCAL(set_fpscr_L1),r1
+#endif
swap.w r4,r0
or #24,r0
#ifndef FMOVD_WORKS
@@ -1923,8 +1933,16 @@ GLOBAL(set_fpscr):
mov.l r3,@(4,r1)
#endif
.align 2
+#ifdef __PIC__
+LOCAL(set_fpscr_L0):
+ .long _GLOBAL_OFFSET_TABLE_
+LOCAL(set_fpscr_L1):
+ .long GLOBAL(fpscr_values@GOT)
+#else
LOCAL(set_fpscr_L1):
.long GLOBAL(fpscr_values)
+#endif
+
#ifdef __ELF__
.comm GLOBAL(fpscr_values),8,4
#else