BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "hadrien Patte" <hadrien.patte@protonmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2] bpftool: Resolve libcrypto link flags via pkg-config
Date: Fri, 01 May 2026 22:58:58 +0000	[thread overview]
Message-ID: <20260501225859.39932C2BCB4@smtp.kernel.org> (raw)
In-Reply-To: <20260501224346.12765-1-hadrien.patte@protonmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The logic to conditionally pass `--static` to `pkg-config` only checks `EXTRA_LDFLAGS`, missing static builds requested via `LDFLAGS`.
--

commit c4bd62b29823641ce51fa6b07b88d88891141b01
Author: Hadrien Patte <hadrien.patte@protonmail.com>

bpftool: Resolve libcrypto link flags via pkg-config

This commit resolves libcrypto link flags for bpftool via pkg-config to correctly
pull in transitive dependencies like libjitterentropy for static builds. It also
adds a fallback to plain -lcrypto if pkg-config is not available.

> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
[ ... ]
> @@ -103,7 +103,35 @@ SKIP_LLVM ?=
>  SKIP_LIBBFD ?=
>  SKIP_CRYPTO ?=
>  ifneq ($(SKIP_CRYPTO),1)
> -  CRYPTO_LIBS := -lcrypto
> +  PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> +  HOSTPKG_CONFIG ?= pkg-config
[ ... ]
> +  # Resolve libcrypto link flags via pkg-config when available, so transitive
> +  # dependencies (e.g. libjitterentropy on distros where libcrypto.a
> +  # references it) are included for static builds. Pass --static when the
> +  # user requested a static build via EXTRA_LDFLAGS=-static.
> +  ifneq ($(filter -static,$(EXTRA_LDFLAGS)),)

If a user requests a static build using LDFLAGS=-static instead of
EXTRA_LDFLAGS=-static, will this check miss it?

The Makefile natively supports passing flags directly via standard LDFLAGS
and aggregates them. By only checking EXTRA_LDFLAGS here, pkg-config might
omit the --static flag when LDFLAGS is used directly. This could drop
transitive dependencies and cause the build to fail with undefined
references.

Would it be better to check LDFLAGS as well?

> +    PKG_CONFIG_LIBCRYPTO := --libs --static libcrypto
> +  else
> +    PKG_CONFIG_LIBCRYPTO := --libs libcrypto
> +  endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260501224346.12765-1-hadrien.patte@protonmail.com?part=1

      reply	other threads:[~2026-05-01 22:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 17:58 [PATCH bpf-next] bpftool: Resolve libcrypto link flags via pkg-config hadrien Patte
2026-05-01 18:11 ` sashiko-bot
2026-05-01 18:37 ` bot+bpf-ci
2026-05-01 19:40 ` Quentin Monnet
2026-05-01 22:45 ` [PATCH bpf-next v2] " hadrien Patte
2026-05-01 22:58   ` 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=20260501225859.39932C2BCB4@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=hadrien.patte@protonmail.com \
    --cc=sashiko@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