Bug 239194

Summary: gcov-enabled kernel can't load modules
Product: Base System Reporter: Alan Somers <asomers>
Component: kernAssignee: Matt Macy <mmacy>
Status: New ---    
Severity: Affects Some People CC: cem, mizhka, pi
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Alan Somers freebsd_committer 2019-07-14 02:22:32 UTC
The gcov support added to the kernel in r344487 doesn't work with modules.  Everything seems to be working for the kernel itself, but when I try to load a module I get this error:

> sudo kldload fdescfs
kldload: an error occurred while loading module fdescfs. Please check dmesg(8) for more details.
> tail -n2 /var/log/messages
Jul 13 20:14:08 fbsd-head kernel: kldload: fdescfs.ko: lost base for reltab
Jul 13 20:14:08 fbsd-head kernel: linker_load_file: /boot/kernel.old/fdescfs.ko - unsupported file type

I don't observe the kldload failure when I build a GENERIC kernel using the amd64-gcc cross toolchain.  I only see it when using the GCOV kernel.  If I cd to /usr/src/sys/modules/whatever and build the module there, then I _can_ load it.  However, coverage data is not collected.

> sudo kldload /boot/modules/fusefs.ko
> uname -a
FreeBSD fbsd-head.lauralan.noip.me 13.0-CURRENT FreeBSD 13.0-CURRENT r349977 GCOV  amd64
> cat sys/amd64/conf/GCOV 
include	GENERIC
ident	GCOV
options	GCOV