BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Chaignon" <paul.chaignon@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: Override EXTRA_LDFLAGS for static builds
Date: Thu, 14 May 2026 04:23:04 +0000	[thread overview]
Message-ID: <20260514042304.EF3ECC2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <714556da329c812988010ffe53173d9152570a78.1778669303.git.paul.chaignon@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The suggested workaround `EXTRA_LDFLAGS=-static` in README.rst breaks the bpftool build or silently disables LLVM support.
--

commit dcbd0d5d7a0eb4a9300ad0890d83b7e4cdfd3aeb
Author: Paul Chaignon <paul.chaignon@gmail.com>

selftests/bpf: Override EXTRA_LDFLAGS for static builds

This commit updates the README.rst for BPF selftests to include
EXTRA_LDFLAGS=-static when recommending how to statically link,
in order to fix shared library loading errors with libLLVM.so
when running vmtest.sh.

> diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst
> index 776fbe3cb8f9b..37164322a1023 100644
> --- a/tools/testing/selftests/bpf/README.rst
> +++ b/tools/testing/selftests/bpf/README.rst
> @@ -77,7 +77,7 @@ In case of linker errors when running selftests, try using static linking:
>  
>  .. code-block:: console
>  
> -  $ LDLIBS=-static PKG_CONFIG='pkg-config --static' vmtest.sh
> +  $ LDLIBS=-static EXTRA_LDFLAGS=-static PKG_CONFIG='pkg-config --static' vmtest.sh

Can adding EXTRA_LDFLAGS=-static break the bpftool build or silently disable
LLVM support?

In the bpftool Makefile, LLVM's --system-libs and -lstdc++ are only appended
to LIBS if llvm-config --shared-mode outputs 'static'. However, the
feature-llvm test in tools/build/feature/Makefile unconditionally includes
--system-libs and uses g++, which automatically includes -lstdc++.

If a system has static LLVM libraries but llvm-config --shared-mode is set
to 'shared' (common on many distros), the feature-llvm test statically links
successfully, but bpftool's Makefile will attempt to build with LLVM support
using gcc -static while omitting --system-libs and -lstdc++. This can cause
the build to fail with undefined references.

Additionally, if static LLVM libraries are entirely absent, the feature test
fails, causing bpftool to silently build without LLVM support.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/714556da329c812988010ffe53173d9152570a78.1778669303.git.paul.chaignon@gmail.com?part=1

      parent reply	other threads:[~2026-05-14  4:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 11:24 [PATCH bpf-next] selftests/bpf: Override EXTRA_LDFLAGS for static builds Paul Chaignon
2026-05-13 15:20 ` Jakub Sitnicki
2026-05-14  4:23 ` sashiko-bot [this message]

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=20260514042304.EF3ECC2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=paul.chaignon@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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