[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:
Brandon Bergren 2019-11-14 19:56:42 +00:00
parent 8a2b184529
commit c16f7fabc7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354713

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