Allow the kernel to build with a compiler that sets -fno-common.

The mechanism that generates assym.inc and offset.inc depends on the
symbols in question being common. For now, simply force the object files
to be created with -fcommon.

-fno-common will be the default in GCC10/LLVM11.

Submitted by:	arichardson
Reviewed by:	kevans
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24322
This commit is contained in:
brooks 2020-04-07 15:32:08 +00:00
parent 8c958c8d9c
commit 32e9335f6f

View File

@ -235,20 +235,20 @@ offset.inc: $S/kern/genoffset.sh genoffset.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genoffset.sh genoffset.o > ${.TARGET}
genoffset.o: $S/kern/genoffset.c
${CC} -c ${CFLAGS:N-flto:N-fno-common} $S/kern/genoffset.c
${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon $S/kern/genoffset.c
# genoffset_test.o is not actually used for anything - the point of compiling it
# is to exercise the CTASSERT that checks that the offsets in the offset.inc
# _lite struct(s) match those in the original(s).
genoffset_test.o: $S/kern/genoffset.c offset.inc
${CC} -c ${CFLAGS:N-flto:N-fno-common} -DOFFSET_TEST \
${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon -DOFFSET_TEST \
$S/kern/genoffset.c -o ${.TARGET}
assym.inc: $S/kern/genassym.sh genassym.o genoffset_test.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genassym.sh genassym.o > ${.TARGET}
genassym.o: $S/$M/$M/genassym.c offset.inc
${CC} -c ${CFLAGS:N-flto:N-fno-common} $S/$M/$M/genassym.c
${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon $S/$M/$M/genassym.c
OBJS_DEPEND_GUESS+= opt_global.h
genoffset.o genassym.o vers.o: opt_global.h