1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00
freebsd/sys
John Baldwin f39b4f8899 Work around lld's inability to handle undefined weak symbols on risc-v.
lld on RISC-V is not yet able to handle undefined weak symbols for
non-PIC code in the code model (medany/medium) used by the RISC-V
kernel.

Both GCC and clang emit an auipc / addi pair of instructions to
generate an address relative to the current PC with a 31-bit offset.
Undefined weak symbols need to have an address of 0, but the kernel
runs with PC values much greater than 2^31, so there is no way to
construct a NULL pointer as a PC-relative value.  The bfd linker
rewrites the instruction pair to use lui / addi with values of 0 to
force a NULL pointer address.  (There are similar cases for 'ld'
becoming auipc / ld that bfd rewrites to lui / ld with an address of
0.)

To work around this, compile the kernel with -fPIE when using lld.
This does not make the kernel position-independent, but it does
force the compiler to indirect address lookups through GOT entries
(so auipc / ld against a GOT entry to fetch the address).  This
adds extra memory indirections for global symbols, so should be
disabled once lld is finally fixed.

A few 'la' instructions in locore that depend on PC-relative
addressing to load physical addresses before paging is enabled have to
use auipc / addi and not indirect via GOT entries, so change those to
use 'lla' which always uses auipc / addi for both PIC and non-PIC.

Submitted by:	jrtc27
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23064
2020-01-07 23:18:31 +00:00
..
amd64 sysctl: mark more nodes as MPSAFE 2020-01-06 10:52:13 +00:00
arm Add #ifdef option-test wrappers around another call to an arm/unwind.c 2020-01-07 21:13:34 +00:00
arm64 Add more Arm arm64 CPU identification values 2020-01-06 20:57:59 +00:00
bsm Jail and capability mode for shm_rename; add audit support for shm_rename 2019-11-18 13:31:16 +00:00
cam vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
cddl zfs: plug a vnode reserve leak in zfs_make_xattrdir 2020-01-07 04:34:29 +00:00
compat vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT) 2020-01-07 15:56:24 +00:00
conf Work around lld's inability to handle undefined weak symbols on risc-v. 2020-01-07 23:18:31 +00:00
contrib [PowerPC] Clang powerpcspe build fixes 2019-12-27 05:01:13 +00:00
crypto Fix the armv8 crypto driver after r354170. 2019-10-30 10:41:10 +00:00
ddb sleep(9), sleepqueue(9): const'ify wchan pointers 2019-12-24 16:19:33 +00:00
dev Increate HMB limit from 1% to 5%. 2020-01-07 23:10:38 +00:00
dts
fs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
gdb [PPC] Handle qOffsets packet 2019-12-16 13:17:39 +00:00
geom vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT) 2020-01-07 15:56:24 +00:00
gnu Import DTS files for riscv from Linux 5.4 2019-12-03 09:12:53 +00:00
i386 Define a unified pmap structure for i386. 2020-01-07 15:59:31 +00:00
isa sc(4) md bits: stop setting sc->kbd entirely 2019-12-30 02:07:55 +00:00
kern vfs: handle doomed vnodes in vdefer_inactive 2020-01-07 20:24:21 +00:00
kgssapi
libkern random(9): Deprecate random(9), remove meaningless srandom(9) 2019-12-26 19:41:09 +00:00
mips Simplify arguments to signal handlers on mips. 2020-01-06 18:02:02 +00:00
modules Add support for i2c bus mux hardware. 2020-01-02 17:51:49 +00:00
net Fix rtsock route message generation for interface addresses. 2020-01-07 21:16:30 +00:00
net80211
netgraph netgraph/ng_bridge: Reestablish old ABI 2020-01-05 19:14:16 +00:00
netinet Do not define TCPOUTFLAGS in rack_bbr_common 2020-01-07 17:57:08 +00:00
netinet6 Fix rtsock route message generation for interface addresses. 2020-01-07 21:16:30 +00:00
netipsec Fix m_pullup() problem after removing PULLDOWN_TESTs and KAME EXT_*macros. 2019-12-01 00:22:04 +00:00
netpfil ipfw: Don't rollback state in alloc_table_vidx() if atomicity is not required. 2019-12-19 10:22:16 +00:00
netsmb
nfs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
nfsclient
nfsserver
nlm vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
ofed Prevent potential underflow in ibcore. 2019-11-15 11:46:53 +00:00
opencrypto Add support for TLS 1.3 using AES-GCM to the OCF backend for KTLS. 2019-12-18 01:37:00 +00:00
powerpc powerpc: Remove 'sec' device from QORIQ64 config 2020-01-04 01:13:00 +00:00
riscv Work around lld's inability to handle undefined weak symbols on risc-v. 2020-01-07 23:18:31 +00:00
rpc Change r355157 to make svc_rpc_gss_lifetime_max a static. 2019-11-28 02:18:51 +00:00
security vfs: eliminate v_tag from struct vnode 2020-01-07 04:29:34 +00:00
sparc64 sc(4) md bits: stop setting sc->kbd entirely 2019-12-30 02:07:55 +00:00
sys vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT) 2020-01-07 15:56:24 +00:00
teken
tests
tools vfs: allow tail call optimisation in vops in the common case 2019-12-16 00:07:51 +00:00
ufs vfs: drop thread argument from vinactive 2020-01-05 00:59:47 +00:00
vm Fix uma boot pages calculations on NUMA machines that also don't have 2020-01-06 02:51:19 +00:00
x86 Introduce the concept of busdma tag templates. A template can be allocated 2019-12-24 14:48:46 +00:00
xdr
xen
Makefile