mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
Fix objtool build error in non-standard static library build
environments. Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAml0jzERHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1gVCxAAv5I9R4UK4jR2mCZE82ye7dofNDeOT+Kd X3vrpeDq+vwjLvONHIdJoTVAw1jTCfroczwdaV+txrtVW/0Wsms8dD38rHTN22xg LU1qn8iKuqXuDBw8O68Pm+XtbF86U0QntlGUsskJb8uXp8VOmhaKRolGwyy/drhS x3Z67uD2fvLO8M4J99qp/YNwuKngS4TslTxrMnykOFJ2zDA3l0rYqkHkYq5ULgQo 9dVJ4GQ8CROOm4nCGy0rSMKC98W670JMqDPRqoyxXVqK5RqVSz18shSKym2ev+ER kE1Lh4MUvosXQV1fa/MbcsTRmPwaIoNocjLerof8kzYM2FRJPhiqifJADAwzkTFt zm3HmGL/jn/whTYDI8Bf0RDT+9yg+v1kN5+CD1KWQd55B3y6cYZY+CIK0vt4f13U wEZjDTJBxo7qPH65em/IL8qH30xh7Zzgj4v/xpG9aMHbh5m2DY0uSfycq9bC5yut /GrKhu8zqRCKrm6XMvkOTK6gZNh6Ph6ZDRss5K+hVXS3nyoiGYAmVTTjgzLL4rel 7LUCQXNxVrKEK6bqi8R9EaAGqMsTGeYHumpjVA3euoCCpbLuWuUWx9ONi2rv8njp 5VcWVbI/RIahh/+z8NoYjhlO6NlL4XQqbJa8zrhMbaRUeZ3vnz/eqyl2WiRhmJna z3MiibvYJK4= =UnzZ -----END PGP SIGNATURE----- Merge tag 'objtool-urgent-2026-01-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull objtool fix from Ingo Molnar: "Fix objtool build error in non-standard static library build environments" * tag 'objtool-urgent-2026-01-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix libopcodes linking with static libraries
This commit is contained in:
commit
dc67a35505
1 changed files with 17 additions and 4 deletions
|
|
@ -77,8 +77,21 @@ HOST_OVERRIDES := CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)"
|
|||
# We check using HOSTCC directly rather than the shared feature framework
|
||||
# because objtool is a host tool that links against host libraries.
|
||||
#
|
||||
HAVE_LIBOPCODES := $(shell echo 'int main(void) { return 0; }' | \
|
||||
$(HOSTCC) -xc - -o /dev/null -lopcodes 2>/dev/null && echo y)
|
||||
# When using shared libraries, -lopcodes is sufficient as dependencies are
|
||||
# resolved automatically. With static libraries, we must explicitly link
|
||||
# against libopcodes' dependencies: libbfd, libiberty, and sometimes libz.
|
||||
# Try each combination and use the first one that succeeds.
|
||||
#
|
||||
LIBOPCODES_LIBS := $(shell \
|
||||
for libs in "-lopcodes" \
|
||||
"-lopcodes -lbfd" \
|
||||
"-lopcodes -lbfd -liberty" \
|
||||
"-lopcodes -lbfd -liberty -lz"; 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 && \
|
||||
echo "$$libs" && break; \
|
||||
done)
|
||||
|
||||
# Styled disassembler support requires binutils >= 2.39
|
||||
HAVE_DISASM_STYLED := $(shell echo '$(pound)include <dis-asm.h>' | \
|
||||
|
|
@ -86,10 +99,10 @@ HAVE_DISASM_STYLED := $(shell echo '$(pound)include <dis-asm.h>' | \
|
|||
|
||||
BUILD_DISAS := n
|
||||
|
||||
ifeq ($(HAVE_LIBOPCODES),y)
|
||||
ifneq ($(LIBOPCODES_LIBS),)
|
||||
BUILD_DISAS := y
|
||||
OBJTOOL_CFLAGS += -DDISAS -DPACKAGE='"objtool"'
|
||||
OBJTOOL_LDFLAGS += -lopcodes
|
||||
OBJTOOL_LDFLAGS += $(LIBOPCODES_LIBS)
|
||||
ifeq ($(HAVE_DISASM_STYLED),y)
|
||||
OBJTOOL_CFLAGS += -DDISASM_INIT_STYLED
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue