summaryrefslogtreecommitdiffstats
path: root/tools/objtool/Makefile
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-01-28 11:22:06 +0000
committerMark Brown <broonie@kernel.org>2026-01-28 11:22:06 +0000
commit751ec6dd6773237bf480291ca894a696a2991c62 (patch)
tree6ac1b53826f7836b3f7b29f3f17bb45d118535c0 /tools/objtool/Makefile
parente540be7d56d740144b1bd6f220b61ffe2f3830d4 (diff)
parent04f7516ab70f7b82aae1d2830af2ee6f17f3fe98 (diff)
downloadlinux-751ec6dd6773237bf480291ca894a696a2991c62.tar.gz
linux-751ec6dd6773237bf480291ca894a696a2991c62.zip
spi: aspeed: Improve handling of shared SPI
Merge series from Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>: This patch series improves handling of SPI controllers that are shared by spi-mem devices and other SPI peripherals. The primary goal of this series is to support non-spi-mem devices in the ASPEED FMC/SPI controller driver. It also addresses an issue in the spi-mem framework observed when different types of SPI devices operate concurrently on the same controller, ensuring that spi-mem operations are properly serialized.
Diffstat (limited to 'tools/objtool/Makefile')
-rw-r--r--tools/objtool/Makefile21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 9b4503113ce5..a40f30232929 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -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