Installing debug modules was a bad idea -- I bogusly assumed that
our kernel linker will only load PT_LOAD segments, apparently not. Instead, produce .dbg objects from .debug objects, and install them together with non-debug objects, as described in objcopy(1). Original code by: obrien
This commit is contained in:
parent
55ac4c3523
commit
98b45a8ff8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151731
@ -67,8 +67,11 @@ modules-all modules-depend: modules-obj
|
||||
FULLKERNEL= ${KERNEL_KO}
|
||||
.else
|
||||
FULLKERNEL= ${KERNEL_KO}.debug
|
||||
${KERNEL_KO}: ${FULLKERNEL}
|
||||
${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO}
|
||||
${KERNEL_KO}: ${FULLKERNEL} ${KERNEL_KO}.dbg
|
||||
${OBJCOPY} --strip-debug --add-gnu-debuglink=${KERNEL_KO}.dbg\
|
||||
${FULLKERNEL} ${.TARGET}
|
||||
${KERNEL_KO}.dbg: ${FULLKERNEL}
|
||||
${OBJCOPY} --only-keep-debug ${FULLKERNEL} ${.TARGET}
|
||||
install.debug reinstall.debug: gdbinit
|
||||
cd ${.CURDIR}; ${MAKE} ${.TARGET:R}
|
||||
|
||||
@ -109,7 +112,8 @@ ${mfile:T:S/.m$/.h/}: ${mfile}
|
||||
|
||||
kernel-clean:
|
||||
rm -f *.o *.so *.So *.ko *.s eddep errs \
|
||||
${FULLKERNEL} ${KERNEL_KO} linterrs makelinks tags vers.c \
|
||||
${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.dbg \
|
||||
linterrs makelinks tags vers.c \
|
||||
vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \
|
||||
${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
|
||||
${CLEAN}
|
||||
@ -186,7 +190,7 @@ kernel-install: kernel-install-check
|
||||
.endif
|
||||
|
||||
kernel-install:
|
||||
@if [ ! -f ${FULLKERNEL} ] ; then \
|
||||
@if [ ! -f ${KERNEL_KO} ] ; then \
|
||||
echo "You must build a kernel first." ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@ -205,18 +209,16 @@ kernel-install:
|
||||
fi
|
||||
.endif
|
||||
mkdir -p ${DESTDIR}${KODIR}
|
||||
.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR}/${KERNEL_KO}
|
||||
.else
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
|
||||
.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.dbg ${DESTDIR}${KODIR}
|
||||
.endif
|
||||
|
||||
kernel-reinstall:
|
||||
@-chflags -R noschg ${DESTDIR}${KODIR}
|
||||
.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR}/${KERNEL_KO}
|
||||
.else
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
|
||||
.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.dbg ${DESTDIR}${KODIR}
|
||||
.endif
|
||||
|
||||
config.o env.o hints.o vers.o vnode_if.o:
|
||||
|
@ -143,8 +143,11 @@ PROG= ${KMOD}.ko
|
||||
FULLPROG= ${PROG}
|
||||
.else
|
||||
FULLPROG= ${PROG}.debug
|
||||
${PROG}: ${FULLPROG}
|
||||
${OBJCOPY} --strip-debug ${FULLPROG} ${PROG}
|
||||
${PROG}: ${FULLPROG} ${PROG}.dbg
|
||||
${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.dbg\
|
||||
${FULLPROG} ${.TARGET}
|
||||
${PROG}.dbg: ${FULLPROG}
|
||||
${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET}
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} != amd64
|
||||
@ -226,7 +229,7 @@ ${_ILINKS}:
|
||||
CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} ${_ILINKS}
|
||||
|
||||
.if defined(DEBUG_FLAGS)
|
||||
CLEANFILES+= ${FULLPROG}
|
||||
CLEANFILES+= ${FULLPROG} ${PROG}.dbg
|
||||
.endif
|
||||
|
||||
.if !target(install)
|
||||
@ -240,12 +243,11 @@ _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
|
||||
realinstall: _kmodinstall
|
||||
.ORDER: beforeinstall _kmodinstall
|
||||
_kmodinstall:
|
||||
.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
|
||||
${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}/${PROG}
|
||||
.else
|
||||
${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
|
||||
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}
|
||||
.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG)
|
||||
${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
|
||||
${_INSTALLFLAGS} ${PROG}.dbg ${DESTDIR}${KMODDIR}
|
||||
.endif
|
||||
|
||||
.include <bsd.links.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user