Re: [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback
From: Peter Zijlstra
Date: Wed Sep 09 2026 - 18:16:02 EST
On Wed, Sep 09, 2026 at 01:41:22PM -0700, Ian Rogers wrote:
> Distributions like Fedora currently ship a statically compiled binutils
> libbfd (an intrinsic dependency of libopcodes) that internally utilizes
> zstd to decompress sections.
>
> Because objtool resolves host dependencies sequentially via a manual HOSTCC
> shell loop, build failures will occur (e.g. undefined reference to
> 'ZSTD_decompress') unless the loop probes for it.
>
> Add the '-lopcodes -lbfd -liberty -lz -lzstd' combination to the fallback
> chain, assuring successful compilation on hosts packaging static binutils.
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> Assisted-by: Antigravity:gemini-3.1-pro
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> tools/objtool/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index a4484fd22a96..141b957c566b 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -88,7 +88,8 @@ LIBOPCODES_LIBS := $(shell \
> for libs in "-lopcodes" \
> "-lopcodes -lbfd" \
> "-lopcodes -lbfd -liberty" \
> - "-lopcodes -lbfd -liberty -lz"; do \
> + "-lopcodes -lbfd -liberty -lz" \
> + "-lopcodes -lbfd -liberty -lz -lzstd"; do \
> echo 'extern void disassemble_init_for_target(void *);' \
> 'int main(void) { disassemble_init_for_target(0); return 0; }' | \
> $(HOSTCC) -xc - -o /dev/null $$libs 2>/dev/null && \
> --
> 2.55.0.1003.g10538fe699-goog
>