[PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback
From: Ian Rogers
Date: Wed Sep 09 2026 - 17:10:19 EST
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
---
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