diff options
author | ru <ru@FreeBSD.org> | 2005-10-27 14:24:45 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-10-27 14:24:45 +0000 |
commit | c771550d168007ede459f3a42c5bcbf710684830 (patch) | |
tree | 5c34a77ae04255b0b8f74f2e1feb2f7f0cab1d78 /sys/conf/kern.post.mk | |
parent | 912a374cd0d0fe5652fc00f90abbe8545f22d897 (diff) | |
download | FreeBSD-src-c771550d168007ede459f3a42c5bcbf710684830.zip FreeBSD-src-c771550d168007ede459f3a42c5bcbf710684830.tar.gz |
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
Diffstat (limited to 'sys/conf/kern.post.mk')
-rw-r--r-- | sys/conf/kern.post.mk | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 40cd967..3556b6a 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -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: |