From: miod Date: Fri, 13 Jan 2023 17:52:08 +0000 (+0000) Subject: Move all data from .text section to .rodata, and update the code to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=50caa7fd37738b8da47f5e44620323327a24b664;p=openbsd Move all data from .text section to .rodata, and update the code to fetch them correctly when building PIC. ok kettenis@ --- diff --git a/lib/libc/arch/sparc64/gen/fixunsdfsi.S b/lib/libc/arch/sparc64/gen/fixunsdfsi.S index a515c828701..4ab913bc4a6 100644 --- a/lib/libc/arch/sparc64/gen/fixunsdfsi.S +++ b/lib/libc/arch/sparc64/gen/fixunsdfsi.S @@ -1,4 +1,4 @@ -/* $OpenBSD: fixunsdfsi.S,v 1.4 2012/08/22 17:19:35 pascal Exp $ */ +/* $OpenBSD: fixunsdfsi.S,v 1.5 2023/01/13 17:52:08 miod Exp $ */ /* $NetBSD: fixunsdfsi.S,v 1.3 2000/07/25 04:26:12 mycroft Exp $ */ /* * Copyright (c) 1992, 1993 @@ -44,6 +44,7 @@ * that it really matters, by using `fbul,a'. */ + .section .rodata .align 8 Lbigd: .word 0x43e00000 ! .double 2^63 @@ -55,11 +56,14 @@ Lbigf: *unsigned long __dtoul(double): * double -> unsigned long */ + .text ENTRY(__dtoul) sub %sp, 16, %sp std %f2, [%sp + 64 + BIAS + 8] #ifdef __PIC__ - PICCY_SET(Lbigd, %g1, %o0) + PIC_PROLOGUE(%o5, %o4) + set Lbigd, %o4 + ldx [%o5 + %o4], %g1 ldd [%g1], %f2 #else sethi %hi(Lbigd), %g1 @@ -101,7 +105,9 @@ ENTRY(__ftoul) st %f1, [%sp + 64 + BIAS + 8] st %f2, [%sp + 64 + BIAS + 12] #ifdef __PIC__ - PICCY_SET(Lbigf, %g1, %o0) + PIC_PROLOGUE(%o5, %o4) + set Lbigf, %o4 + ldx [%o5 + %o4], %g1 ld [%g1], %f2 #else sethi %hi(Lbigf), %g1 diff --git a/lib/libc/arch/sparc64/gen/modf.S b/lib/libc/arch/sparc64/gen/modf.S index 9850b7d94f3..4fa2ea515f2 100644 --- a/lib/libc/arch/sparc64/gen/modf.S +++ b/lib/libc/arch/sparc64/gen/modf.S @@ -1,4 +1,4 @@ -/* $OpenBSD: modf.S,v 1.6 2012/08/22 17:19:35 pascal Exp $ */ +/* $OpenBSD: modf.S,v 1.7 2023/01/13 17:52:08 miod Exp $ */ /* $NetBSD: modf.S,v 1.3 2000/11/01 23:32:41 eeh Exp $ */ /* @@ -76,6 +76,7 @@ * %f6:f7 double temp. */ + .section .rodata .align 8 Lmagic: .word 0x43300000 ! sign = 0, exponent = 52 + 1023, mantissa = 0 @@ -85,8 +86,12 @@ L0: .word 0 ! 0.0 .word 0 + .text ENTRY(modf) save %sp, -CC64FSZ-16, %sp +#ifdef __PIC__ + PIC_PROLOGUE(%o5, %o4) +#endif /* * First, compute v = abs(val) @@ -94,7 +99,8 @@ ENTRY(modf) fabsd %f0, %f4 ! %f4:f5 = v fcmped %fcc1, %f0, %f4 ! %fcc1 = (val == abs(val)) #ifdef __PIC__ - PICCY_SET(Lmagic, %l0, %o7) + set Lmagic, %o4 + ldx [%o5 + %o4], %l0 ldd [%l0], %f2 #else sethi %hi(Lmagic), %l0 @@ -168,7 +174,8 @@ Lbig: * fractional part is 0. */ #ifdef __PIC__ - PICCY_SET(L0, %l0, %o7) + set L0, %o4 + ldx [%o5 + %o4], %l0 std %f0, [%i1] ! *ival = val; ldd [%l0], %f0 ! return 0.0; #else diff --git a/lib/libc/arch/sparc64/string/ffs.S b/lib/libc/arch/sparc64/string/ffs.S index 7552c407b45..74fc4f7d0c0 100644 --- a/lib/libc/arch/sparc64/string/ffs.S +++ b/lib/libc/arch/sparc64/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.9 2022/12/08 01:25:43 guenther Exp $ */ +/* $OpenBSD: ffs.S,v 1.10 2023/01/13 17:52:08 miod Exp $ */ /* * Copyright (c) 1992, 1993 @@ -50,7 +50,9 @@ */ ENTRY(ffs) #ifdef __PIC__ - PICCY_SET(__ffstab, %o2, %o3) + PIC_PROLOGUE(%o5, %o4) + set __ffstab, %o4 + ldx [%o5 + %o4], %o2 #else set __ffstab, %o2 #endif @@ -86,6 +88,7 @@ ENTRY(ffs) END(ffs) .protected ffs + .section .rodata __ffstab: .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */ diff --git a/lib/libc/arch/sparc64/sys/brk.S b/lib/libc/arch/sparc64/sys/brk.S index 337ab251699..a8636e2e326 100644 --- a/lib/libc/arch/sparc64/sys/brk.S +++ b/lib/libc/arch/sparc64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.10 2022/12/08 01:25:44 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.11 2023/01/13 17:52:08 miod Exp $ */ /* $NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $ */ /* @@ -51,7 +51,7 @@ __minbrk: ENTRY_NB(brk) #ifdef __PIC__ - PIC_PROLOGUE(%o5,%o4) + PIC_PROLOGUE(%o5, %o4) set __minbrk, %o4 ldx [%o5 + %o4], %o4 ldx [%o4], %o1 /* %o1 = minbrk */ diff --git a/lib/libc/arch/sparc64/sys/sbrk.S b/lib/libc/arch/sparc64/sys/sbrk.S index 5daf57093df..09d2a4f093f 100644 --- a/lib/libc/arch/sparc64/sys/sbrk.S +++ b/lib/libc/arch/sparc64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.8 2022/12/08 01:25:44 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.9 2023/01/13 17:52:08 miod Exp $ */ /* $NetBSD: sbrk.S,v 1.7 2000/07/25 15:14:46 mycroft Exp $ */ /* @@ -52,7 +52,7 @@ __curbrk: ENTRY_NB(sbrk) #ifdef __PIC__ - PIC_PROLOGUE(%o5,%o4) + PIC_PROLOGUE(%o5, %o4) set __curbrk, %o3 ldx [%o5 + %o3], %o2 ldx [%o2], %o3 /* %o3 = old break */