Message ID | 20231020092159.2486063-1-michal.winiarski@intel.com |
---|---|
Headers | show |
Series | um: kunit: Add Clang support for CONFIG_GCOV | expand |
On 20/10/23 06:21, Michał Winiarski wrote: > Clang uses a different set of CLI args for coverage, and the output > needs to be processed by a different set of tools. > Update the Makefile and add an example of usage in kunit docs. Great change! It's great not to rely on older versions of GCC for that. I was able to generate coverage reports, but I have a few of things to note: When I ran the kunit.py it generated this warning several times: WARNING: modpost: vmlinux (__llvm_covfun): unexpected non-allocatable section. Did you forget to use "ax"/"aw" in a .S file? Note that for example <linux/init.h> contains section definitions for use in .S files. Maybe it would be great to know why this is happening. Also, the linker consumed a lot of RAM to build the kernel with those additional flags, but maybe this is expected :P. Best Regards, ~Arthur Grillo > > Michał Winiarski (2): > arch: um: Add Clang coverage support > Documentation: kunit: Add clang UML coverage example > > Documentation/dev-tools/kunit/running_tips.rst | 11 +++++++++++ > arch/um/Makefile-skas | 5 +++++ > 2 files changed, 16 insertions(+) >
On Fri, 20 Oct 2023 at 17:22, Michał Winiarski <michal.winiarski@intel.com> wrote: > > Clang uses a different set of command line arguments for enabling > coverage. > > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> > --- This works brilliantly here -- I'm very glad to finally be able to use something newer than gcc 6! I assume this will go in via the UML tree, but if you want, we can take it via KUnit. Tested-by: David Gow <davidgow@google.com> Cheers, -- David > arch/um/Makefile-skas | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/um/Makefile-skas b/arch/um/Makefile-skas > index ac35de5316a6..67323b028999 100644 > --- a/arch/um/Makefile-skas > +++ b/arch/um/Makefile-skas > @@ -4,7 +4,12 @@ > # > > GPROF_OPT += -pg > + > +ifdef CONFIG_CC_IS_CLANG > +GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping > +else > GCOV_OPT += -fprofile-arcs -ftest-coverage > +endif > > CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT) > CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT) > -- > 2.42.0 >