Re: [PATCH] compiler-gcc: get back Clang build

From: Dominique Martinet
Date: Wed Aug 22 2018 - 19:59:29 EST


Nick Desaulniers wrote on Wed, Aug 22, 2018:
> I'm currently testing a fix in
> https://github.com/ClangBuiltLinux/linux/commit/1f89ae7622c26b8131f42f3a362d6ef41b88a595,
> can you please share with me your steps to test/verify that the patch
> fixes the issue for eBPF? I'll go talk to a co-worker who know more
> about eBPF, but I've not yet done anything with it.

Thanks for the link.

The simplest way to test with bcc for me would probably be to fetch the
example from their repo itself[1], whether you install bcc through your
distro or compile it yourself.

There are dozens of example programs in the tools/ directory of which
you can just run any, if will try to compile the program embedded wihtin
the example at runtime with clang.

[1] https://github.com/iovisor/bcc

(I just noticed fedora provides a bcc-tools package which provides these
tools directly, so if you're lucky you can just install that and run
examples in /usr/share/bcc/tools)



In particular I get a couple of errors with your patch, I think it boils
down to this one:
-----
In file included from <built-in>:3:
In file included from /virtual/include/bcc/helpers.h:23:
In file included from /lib/modules/4.18.0+/build/include/linux/log2.h:16:
In file included from /lib/modules/4.18.0+/build/include/linux/bitops.h:18:
In file included from /lib/modules/4.18.0+/build/arch/x86/include/asm/bitops.h:16:
/lib/modules/4.18.0+/build/include/linux/compiler.h:217:3: error:
expected expression
barrier();
^
/lib/modules/4.18.0+/build/include/linux/compiler-clang.h:43:20: note:
expanded from macro 'barrier'
#define barrier() (__asm__ __volatile__("" : : : "memory"))
^
-----

And removing the parenthesis around the expression seems to work, they
weren't here in the compiler-gcc.h file in the previous version?

There might be other defines the simple examples I ran do not use but
from a quick glance it doesn't look like it, thank you for the split
work!

--
Dominique Martinet