Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Apr 2009 12:16:32 -0700
From:      Navdeep Parhar <nparhar@gmail.com>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   KLDs missing CTF information (patch attached)
Message-ID:  <d04e16b70904071216v2f4c57a6v9b6e9de7cab9c248@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
It appears that the KLD build process is missing a ctfmerge at the end, and
this results in KLDs with incomplete CTF information.

Here is a patch that fixes this.  I verified it on amd64 with various KLDs.

Before:
# ctfdump /boot/kernel/if_cxgb.ko | wc -l
 2269
# ctfdump /boot/kernel/zfs.ko | wc -l
430

After:
# ctfdump /boot/kernel/if_cxgb.ko | wc -l
6568
# ctfdump /boot/kernel/zfs.ko | wc -l
15032

It is wasteful to have CTF information in both the .ko and the .ko.symbols file
but this is what the kernel does too.

Regards,
Navdeep

[-- Attachment #2 --]
diff -r b3f4e6a82a86 sys/conf/kmod.mk
--- a/sys/conf/kmod.mk	Mon Apr 06 13:47:39 2009 -0700
+++ b/sys/conf/kmod.mk	Tue Apr 07 12:00:52 2009 -0700
@@ -128,6 +128,10 @@
 CFLAGS+=	-mlongcall -fno-omit-frame-pointer
 .endif
 
+.if defined(DEBUG) || defined(DEBUG_FLAGS)
+CTFFLAGS+=	-g
+.endif
+
 .if defined(FIRMWS)
 .if !exists(@)
 ${KMOD:S/$/.c/}: @
@@ -193,6 +197,9 @@
 ${FULLPROG}: ${OBJS}
 .endif
 	${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
+.if defined(CTFMERGE)
+	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
+.endif
 .if defined(EXPORT_SYMS)
 .if ${EXPORT_SYMS} != YES
 .if ${EXPORT_SYMS} == NO

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d04e16b70904071216v2f4c57a6v9b6e9de7cab9c248>