Skip to content

Commit

Permalink
Make kldxref a bootstrap tool and use unconditionally
Browse files Browse the repository at this point in the history
Now that kldxref is a generic cross tool and can be built on non-FreeBSD
we can bootstrap it during the build and thus remove the condition for
whether it exists. We also need to make sure to add it to the METALOG
for -DNO_ROOT builds.

Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D43051
  • Loading branch information
jrtc27 committed Dec 13, 2023
1 parent e131d3f commit ff7c12c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -2410,8 +2410,12 @@ _bootstrap_tools_links+=m4 lex
_elftoolchain_libs= lib/libelf lib/libdwarf lib/libzstd
${_bt}-lib/libelf: ${_bt_m4_depend}
${_bt}-lib/libdwarf: ${_bt_m4_depend}
_bt_libelf_depend=${_bt}-lib/libelf
.endif

_kldxref= usr.sbin/kldxref
${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend}

# flua is required to regenerate syscall files. It first appeared during the
# 13.0-CURRENT cycle, thus needs to be built on -older releases and stable
# branches.
Expand Down Expand Up @@ -2673,6 +2677,7 @@ bootstrap-tools: ${_bt}-links .PHONY
${_cat} \
${_kbdcontrol} \
${_elftoolchain_libs} \
${_kldxref} \
lib/libopenbsd \
usr.bin/mandoc \
usr.bin/rpcgen \
Expand Down
9 changes: 5 additions & 4 deletions sys/conf/kmod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,11 @@ afterinstall: _kldxref
.ORDER: realinstall _kldxref
.ORDER: _installlinks _kldxref
_kldxref: .PHONY
@if type kldxref >/dev/null 2>&1; then \
${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
fi
${KLDXREF_CMD} ${DESTDIR}${KMODDIR}
.if defined(NO_ROOT) && defined(METALOG)
echo ".${DISTBASE}${KMODDIR}/linker.hints type=file mode=0644 uname=root gname=wheel" | \
cat -l >> ${METALOG}
.endif
.endif
.endif # !target(realinstall)

Expand Down
9 changes: 5 additions & 4 deletions sys/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,11 @@ SUBDIR:= ${SUBDIR:N${reject}}
.if !defined(NO_XREF)
.MAKEFLAGS+= -DNO_XREF
afterinstall: .PHONY
@if type kldxref >/dev/null 2>&1; then \
${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
fi
${KLDXREF_CMD} ${DESTDIR}${KMODDIR}
.if defined(NO_ROOT) && defined(METALOG)
echo ".${DISTBASE}${KMODDIR}/linker.hints type=file mode=0644 uname=root gname=wheel" | \
cat -l >> ${METALOG}
.endif
.endif

SUBDIR:= ${SUBDIR:u:O}
Expand Down
2 changes: 2 additions & 0 deletions tools/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/elf.h
SYSINCS+= ${SRCTOP}/sys/sys/ctf.h
# for kbdcontrol:
SYSINCS+= ${SRCTOP}/sys/sys/kbio.h
# for kldxref:
SYSINCS+= ${SRCTOP}/sys/sys/module.h

# We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't
# accidentally run tools that are incompatible but happen to be in $PATH.
Expand Down

0 comments on commit ff7c12c

Please sign in to comment.