1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00
freebsd/sys/conf
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
..
config.mk
dtb.build.mk Introduce bsd.sysdir.mk to consolidate looking for the kernel. 2019-11-21 15:59:33 +00:00
dtb.mk
files iicoc: limit fdt attachment to EXT_RESOURCES platforms 2020-01-02 23:00:52 +00:00
files.amd64 Remove sio(4). 2019-11-21 01:24:49 +00:00
files.arm Compile in arm/unwind.c if options STACK is in effect; the new arm stack(9) 2019-11-14 17:04:19 +00:00
files.arm64 arm64: rockchip: Add driver for the io domain 2019-12-28 15:30:50 +00:00
files.i386 Remove sio(4). 2019-11-21 01:24:49 +00:00
files.mips [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations 2020-01-02 23:20:37 +00:00
files.powerpc [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations 2020-01-02 23:20:37 +00:00
files.riscv RISC-V: add support for SBI spec v0.2 2019-11-15 03:34:27 +00:00
files.sparc64 emulate illumos membar_producer with atomic_thread_fence_rel 2019-10-10 07:39:41 +00:00
files.x86 Move all the sys/dev/[a-j]* that are common to files.x86 2019-10-30 19:53:46 +00:00
kern.mk gcc9: quiet Waddress-of-packed-member for kernel build 2019-12-21 02:43:37 +00:00
kern.opts.mk Disable REPRODUCIBLE_BUILD for kernel builds. 2019-09-28 14:14:42 +00:00
kern.post.mk Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
kern.pre.mk Work around lld's inability to handle undefined weak symbols on risc-v. 2020-01-07 23:18:31 +00:00
kmod_syms_prefix.awk
kmod_syms.awk
kmod.mk [PowerPC] Switch to PIC kernel modules on powerpc* 2019-12-27 04:07:51 +00:00
kmod.opts.mk Add a kmod.opts.mk. 2019-11-21 18:14:26 +00:00
ldscript.amd64 Tighten mapping protections on preloaded files on amd64. 2019-10-18 14:05:13 +00:00
ldscript.arm Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker 2019-12-29 18:17:12 +00:00
ldscript.arm64 Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker 2019-12-29 18:17:12 +00:00
ldscript.i386
ldscript.kmod.amd64 Add an ldscript for amd64 kernel modules. 2019-10-17 21:39:23 +00:00
ldscript.kmod.i386 Formalize the use of linker scripts for kernel modules. 2019-10-16 22:19:56 +00:00
ldscript.mips
ldscript.mips.cfe
ldscript.mips.mips64
ldscript.mips.octeon1
ldscript.powerpc powerpc: Kernel fixes for ppc32 and powerpcspe w/ lld 2019-11-14 04:34:17 +00:00
ldscript.powerpc64
ldscript.powerpcspe powerpc: Kernel fixes for ppc32 and powerpcspe w/ lld 2019-11-14 04:34:17 +00:00
ldscript.riscv riscv: Ensure that BSS is 8-byte aligned 2019-09-09 15:57:24 +00:00
ldscript.sparc64
Makefile.amd64
Makefile.arm Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm. 2019-12-30 23:20:46 +00:00
Makefile.arm64 Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker 2019-12-29 18:17:12 +00:00
Makefile.i386
Makefile.mips Update MIPS kernel builds to work with mips-gcc. 2019-10-15 17:11:42 +00:00
Makefile.powerpc [PowerPC] Clang powerpcspe build fixes 2019-12-27 05:01:13 +00:00
Makefile.riscv Revert r356077, apparently the change doesn't work after all (failed to 2019-12-25 18:24:38 +00:00
Makefile.sparc64
makeLINT.mk stop building arm LINT-V5 kernel 2019-11-26 20:46:20 +00:00
makeLINT.sed
newvers.sh
NOTES Add support for i2c bus mux hardware. 2020-01-02 17:51:49 +00:00
options UMA NUMA flag day. UMA_ZONE_NUMA was a source of confusion. Make the names 2020-01-04 18:48:13 +00:00
options.amd64
options.arm arm: add SOC_BRCM_BCM2837 option, include it in GENERIC 2019-12-17 23:01:37 +00:00
options.arm64 Add support for booting kernel directly from U-Boot using booti command. 2019-12-07 16:14:23 +00:00
options.i386
options.mips
options.powerpc powerpc: Add AmigaOne platform, a subclass of MPC85xx 2019-10-16 00:38:50 +00:00
options.riscv
options.sparc64
systags.sh
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST
WITHOUT_SOURCELESS_UCODE