Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2019 19:56:43 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354713 - head/sys/conf
Message-ID:  <201911141956.xAEJuh1A077032@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdragon
Date: Thu Nov 14 19:56:42 2019
New Revision: 354713
URL: https://svnweb.freebsd.org/changeset/base/354713

Log:
  [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

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Thu Nov 14 18:38:56 2019	(r354712)
+++ head/sys/conf/kmod.mk	Thu Nov 14 19:56:42 2019	(r354713)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911141956.xAEJuh1A077032>