Don't delete hack.c - causes perpetual 'out of date' kernel

Deleting hack.c cause the kernel to always be out of date:

   $ make kernel
   make: /usr/src/sys/amd64/compile/GENERIC/.depend.hack.pico, 1:
	     ignoring stale .depend for hack.c
   :> hack.c
   cc -shared -O2 -pipe ... -nostdlib hack.c -o hack.pico
   rm -f hack.c
   MAKE="make" sh ../../../conf/newvers.sh "-R" GENERIC
   cc -c -O2 -pipe ...  -std=iso9899:1999 -Werror  vers.c
   ctfconvert -L VERSION -g vers.o
   linking kernel.full

Keeping hack.c in the compile directory causes no harm,
so there's no reason to delete it.

Also rename the file to "force-dyamic-hack.c" so it is
clear what the hack is aboug.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D34281
This commit is contained in:
David E. O'Brien 2022-02-13 18:24:36 -08:00
parent e49b6ead41
commit aea2a658ef
2 changed files with 8 additions and 6 deletions

View File

@ -230,10 +230,12 @@ kernel-clean:
# This is a hack. BFD "optimizes" away dynamic mode if there are no
# dynamic references. We could probably do a '-Bforcedynamic' mode like
# in the a.out ld. For now, this works.
hack.pico: Makefile
:> hack.c
${CC} ${CCLDFLAGS} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico
rm -f hack.c
force-dynamic-hack.c:
:> ${.TARGET}
force-dynamic-hack.pico: force-dynamic-hack.c Makefile
${CC} ${CCLDFLAGS} -shared ${CFLAGS} -nostdlib \
force-dynamic-hack.c -o ${.TARGET}
offset.inc: $S/kern/genoffset.sh genoffset.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genoffset.sh genoffset.o > ${.TARGET}
@ -444,7 +446,7 @@ config.o env.o hints.o vers.o vnode_if.o:
.if ${MK_REPRODUCIBLE_BUILD} != "no"
REPRO_FLAG="-R"
.endif
vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
vers.c: .NOMETA_CMP $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP:Nvers.*}
MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT}
vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src

View File

@ -314,7 +314,7 @@ SYSTEM_CFILES= config.c env.c hints.c vnode_if.c
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
SYSTEM_OBJS+= hack.pico
SYSTEM_OBJS+= force-dynamic-hack.pico
KEYMAP=kbdcontrol -P ${SRCTOP}/share/vt/keymaps -P ${SRCTOP}/share/syscons/keymaps
KEYMAP_FIX=sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /'