From: Jarkko Sakkinen <jarkko@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Sedat Dilek <sedat.dilek@gmail.com>,
Marco Elver <elver@google.com>,
Andrey Konovalov <andreyknvl@google.com>,
Masahiro Yamada <masahiroy@kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Will Deacon <will@kernel.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1
Date: Wed, 4 Nov 2020 02:38:26 +0200 [thread overview]
Message-ID: <20201104003826.GB19460@kernel.org> (raw)
In-Reply-To: <CAKwvOdk-bMx3Jt6=oN=PHqRv_tx5cF=9cVmumazb4vMNHdj5Ag@mail.gmail.com>
On Tue, Nov 03, 2020 at 10:48:27AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 2, 2020 at 8:55 PM Jarkko Sakkinen <jarkko@kernel.org> wrote:
> >
> > On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > > +#define CLANG_VERSION (__clang_major__ * 10000 \
> > > + + __clang_minor__ * 100 \
> > > + + __clang_patchlevel__)
> > > +
> > > +#if CLANG_VERSION < 100001
> > > +# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> > > +#endif
> >
> >
> > I'm trying to compile a BPF enabled test kernel for a live system and I
> > get this error even though I have much newer clang:
> >
> > ➜ ~ (master) ✔ clang --version
> > Ubuntu clang version 11.0.0-2
> > Target: x86_64-pc-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> >
> > Tried to Google for troubleshooter tips but this patch is basically the
> > only hit I get :-)
>
> To check the values of the above preprocessor defines, please run:
> $ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
>
> If you have multiple versions of clang installed, you might not be
> running the version you think you are. Particularly, if you're using
> bcc, idk if it includes a copy of clang? If that's the case, we may
> have to work out how we can support older versions of clang for the
> express purposes of bpf.
➜ ~ (master) ✔ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
#define __clang_major__ 11
#define __clang_minor__ 0
#define __clang_patchlevel__ 0
I'm compiling the kernel itself with GCC.
Here's an example BPF script that fails on me:
struct sgx_enclave_add_pages {
unsigned long src;
unsigned long offset;
unsigned long length;
unsigned long secinfo;
unsigned long flags;
unsigned long count;
};
kprobe:sgx_ioctl
{
if (arg1 == 0xc030a401) {
printf("sgx_ioctl: %d, %lu\n", pid, ((struct sgx_enclave_add_pages *)(arg2))->offset);
}
}
Note that it relies on code not yet in the mainline.
If I don't declare structs, things work just fine. E.g. the following
works:
kprobe:sgx_encl_get_backing
{
printf("%s\n", func)
}
BTW, I don't really understand how scripts/clang-version.sh is even
supposed to work, if you compile the kernel itself with GCC. In that
case there would be no output, right? And thus version gets set to
zero...
> --
> Thanks,
> ~Nick Desaulniers
/Jarkko
next prev parent reply other threads:[~2020-11-04 0:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 22:59 [PATCH v3 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
2020-11-03 4:55 ` Jarkko Sakkinen
2020-11-03 6:38 ` Nathan Chancellor
2020-11-03 9:00 ` Jarkko Sakkinen
2020-11-03 18:48 ` Nick Desaulniers
2020-11-04 0:38 ` Jarkko Sakkinen [this message]
2020-11-04 1:18 ` Nick Desaulniers
2020-11-04 1:34 ` Jarkko Sakkinen
2020-11-04 1:36 ` Jarkko Sakkinen
2020-11-17 3:04 ` John Hubbard
2020-11-17 18:46 ` Nick Desaulniers
2020-11-18 2:31 ` Nathan Chancellor
2020-11-18 2:37 ` Andrew Morton
2020-09-02 22:59 ` [PATCH v3 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8" Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 5/7] Partially revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer" Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 6/7] kasan: Remove mentions of unsupported Clang versions Nick Desaulniers
2020-09-02 22:59 ` [PATCH v3 7/7] compiler-gcc: improve version error Nick Desaulniers
2020-09-07 21:25 ` Will Deacon
2020-09-03 14:06 ` [PATCH v3 0/7] set clang minimum version to 10.0.1 Sedat Dilek
2020-09-03 17:28 ` Nathan Chancellor
2020-09-04 5:42 ` Miguel Ojeda
2020-09-07 16:12 ` Arvind Sankar
2020-09-08 4:42 ` Nathan Chancellor
2020-09-07 21:26 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201104003826.GB19460@kernel.org \
--to=jarkko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=ast@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=daniel@iogearbox.net \
--cc=elver@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=sedat.dilek@gmail.com \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).