Module Name:    src
Committed By:   rin
Date:           Thu Sep 10 02:34:13 UTC 2020

Modified Files:
        src/share/mk: bsd.kmodule.mk

Log Message:
Turn off -mpltseq for kernel modules on powerpc for GCC >= 9.

Otherwise, object files compiled with -mlongcall contain relocation types
referring PLT, which our in-kernel linker cannot handle.

This ends up with failure in kernel module load with
``kobj_reloc: unexpected relocation type 31'' (31 == R_PPC_PLT16_HA here).

See descriptions for -mlongcall in gcc(1) of GCC9 for more details.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/share/mk/bsd.kmodule.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.70 src/share/mk/bsd.kmodule.mk:1.71
--- src/share/mk/bsd.kmodule.mk:1.70	Sun Sep  6 07:20:28 2020
+++ src/share/mk/bsd.kmodule.mk	Thu Sep 10 02:34:13 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.70 2020/09/06 07:20:28 mrg Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.71 2020/09/10 02:34:13 rin Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -51,6 +51,7 @@ CFLAGS+=	-fno-common -fno-unwind-tables
 CFLAGS+=	-mlong-calls -mno-space-regs -mfast-indirect-calls
 .elif ${MACHINE_CPU} == "powerpc"
 CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mlongcall :}
+CFLAGS+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -mno-pltseq :}
 .elif ${MACHINE_CPU} == "vax"
 CFLAGS+=	-fno-pic
 .elif ${MACHINE_CPU} == "riscv"

Reply via email to