NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/59391 CVS commit: src
The following reply was made to PR lib/59391; it has been noted by GNATS.
From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/59391 CVS commit: src
Date: Sat, 3 May 2025 19:57:13 +0000
Module Name: src
Committed By: riastradh
Date: Sat May 3 19:57:13 UTC 2025
Modified Files:
src/lib/libc/arch/arm/gen: _setjmp.S setjmp.S
src/lib/libc/arch/arm/sys: cerror.S ptrace.S sbrk.S
src/sys/arch/arm/include: asm.h
Log Message:
arm: Nix most __PIC__ conditionals in .S files.
New macros PCREL_GET(rN,label,pclabel) and PCREL_SYM(label,pclabel)
to enable this by the pattern:
ldr rN, label
#ifdef __PIC__
pclabel:
add rN, rN, pc
#endif
...
label:
#ifdef __PIC__
.word (label - (pclabel + 2*sizeof(instruction)))
#else
.word label
#endif
(sizeof(instruction) = 2 for thumb, 4 for non-thumb.)
No binary change in libc with MKPIE=no (i.e., testing both for
changes to the PIC build and changes to the non-PIC build).
In principle, assembly routines could improve instruction scheduling
by splitting up the ldr and add instructions. But in practice, the
maintenance and auditing burden likely makes this worthwhile by
improving legibility vs a tangle of in-line #ifdefs.
brk.S does things a little differently making it harder to unify.
Could redo it but I don't want to make changes without testing them
first.
PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/arch/arm/gen/_setjmp.S
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/arch/arm/gen/setjmp.S
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/arch/arm/sys/cerror.S
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/arch/arm/sys/ptrace.S \
src/lib/libc/arch/arm/sys/sbrk.S
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/include/asm.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index