[PowerPC64] Fix broken kernel modules due to LLD 9+ TOC optimization

LLD9 introduced a TOC optimization that isn't compatible with kernel dynamic
linker causing panic when loading kernel modules (pf, linuxkpi etc.)

This patch disables TOC optimization when building kernel modules.

Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D22317
This commit is contained in:
bdragon 2019-11-14 19:56:42 +00:00
parent b1193a1f2c
commit 548477695e

View File

@ -169,6 +169,10 @@ CFLAGS+= -funwind-tables
.if ${MACHINE_CPUARCH} == powerpc
CFLAGS+= -mlongcall -fno-omit-frame-pointer
.if ${LINKER_TYPE} == "lld"
# TOC optimization in LLD (9.0) currently breaks kernel modules, so disable it
LDFLAGS+= --no-toc-optimize
.endif
.endif
.if ${MACHINE_CPUARCH} == mips