diff mbox series

[RFC,4/6] disas: Have each system target select its disassembler

Message ID 20250103231738.65413-5-philmd@linaro.org
State New
Headers show
Series disas: Allow linking multiple disassemblers in a heterogeneous binary | expand

Commit Message

Philippe Mathieu-Daudé Jan. 3, 2025, 11:17 p.m. UTC
No change for host or user emulation.

For system emulation, each target explicitly selects
its disassembler.

This change allows selecting more than two (host + target)
disassemblers in a binary supporting multiple targets.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build               |  3 ++-
 Kconfig                   |  1 +
 disas/Kconfig             | 56 +++++++++++++++++++++++++++++++++++++++
 target/alpha/Kconfig      |  1 +
 target/avr/Kconfig        |  1 +
 target/hexagon/Kconfig    |  1 +
 target/hppa/Kconfig       |  1 +
 target/i386/Kconfig       |  1 +
 target/loongarch/Kconfig  |  1 +
 target/m68k/Kconfig       |  1 +
 target/microblaze/Kconfig |  1 +
 target/mips/Kconfig       |  1 +
 target/openrisc/Kconfig   |  1 +
 target/ppc/Kconfig        |  1 +
 target/riscv/Kconfig      |  2 ++
 target/rx/Kconfig         |  1 +
 target/s390x/Kconfig      |  1 +
 target/sh4/Kconfig        |  1 +
 target/sparc/Kconfig      |  2 ++
 target/tricore/Kconfig    |  1 +
 target/xtensa/Kconfig     |  1 +
 21 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 disas/Kconfig
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index e62251c7ca3..a35ef579c28 100644
--- a/meson.build
+++ b/meson.build
@@ -3319,7 +3319,8 @@  foreach target : target_dirs
   endif
 
   foreach k, v: disassemblers
-    if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
+    if host_arch.startswith(k) \
+        or (target.endswith('-user') and config_target['TARGET_BASE_ARCH'].startswith(k))
       foreach sym: v
         config_target += { sym: 'y' }
       endforeach
diff --git a/Kconfig b/Kconfig
index 63ca7f46df7..d937ad3b7fe 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,6 +1,7 @@ 
 source Kconfig.host
 source backends/Kconfig
 source accel/Kconfig
+source disas/Kconfig
 source target/Kconfig
 source hw/Kconfig
 source semihosting/Kconfig
diff --git a/disas/Kconfig b/disas/Kconfig
new file mode 100644
index 00000000000..1d2c397c953
--- /dev/null
+++ b/disas/Kconfig
@@ -0,0 +1,56 @@ 
+config ALPHA_DIS
+    bool
+
+config ARM_DIS
+    bool
+
+config AVR_DIS
+    bool
+
+config HEXAGON_DIS
+    bool
+
+config HPPA_DIS
+    bool
+
+config I386_DIS
+    bool
+
+config LOONGARCH_DIS
+    bool
+
+config M68K_DIS
+    bool
+
+config MICROBLAZE_DIS
+    bool
+
+config MIPS_DIS
+    bool
+
+config OPENRISC_DIS
+    bool
+
+config PPC_DIS
+    bool
+
+config RISCV_DIS
+    bool
+
+config RX_DIS
+    bool
+
+config S390_DIS
+    bool
+
+config SH4_DIS
+    bool
+
+config SPARC_DIS
+    bool
+
+config TRICORE_DIS
+    bool
+
+config XTENSA_DIS
+    bool
diff --git a/target/alpha/Kconfig b/target/alpha/Kconfig
index 267222c05b8..1b9cc8077db 100644
--- a/target/alpha/Kconfig
+++ b/target/alpha/Kconfig
@@ -1,2 +1,3 @@ 
 config ALPHA
     bool
+    select ALPHA_DIS
diff --git a/target/avr/Kconfig b/target/avr/Kconfig
index 155592d3537..7a7580c65f7 100644
--- a/target/avr/Kconfig
+++ b/target/avr/Kconfig
@@ -1,2 +1,3 @@ 
 config AVR
     bool
+    select AVR_DIS
diff --git a/target/hexagon/Kconfig b/target/hexagon/Kconfig
index 7e556f35063..a96415fb2fa 100644
--- a/target/hexagon/Kconfig
+++ b/target/hexagon/Kconfig
@@ -1,2 +1,3 @@ 
 config HEXAGON
     bool
+    select HEXAGON_DIS
diff --git a/target/hppa/Kconfig b/target/hppa/Kconfig
index 395a35d799c..e8fbdc02346 100644
--- a/target/hppa/Kconfig
+++ b/target/hppa/Kconfig
@@ -1,2 +1,3 @@ 
 config HPPA
     bool
+    select HPPA_DIS
diff --git a/target/i386/Kconfig b/target/i386/Kconfig
index 6b0feef0299..af603c7cd3a 100644
--- a/target/i386/Kconfig
+++ b/target/i386/Kconfig
@@ -1,5 +1,6 @@ 
 config I386
     bool
+    select I386_DIS
     select APIC
     # kvm_arch_fixup_msi_route() needs to access PCIDevice
     select PCI if KVM
diff --git a/target/loongarch/Kconfig b/target/loongarch/Kconfig
index 46b26b1a857..690404b4a5a 100644
--- a/target/loongarch/Kconfig
+++ b/target/loongarch/Kconfig
@@ -1,2 +1,3 @@ 
 config LOONGARCH64
     bool
+    select LOONGARCH_DIS
diff --git a/target/m68k/Kconfig b/target/m68k/Kconfig
index 23aae24ebec..57cd896dd0e 100644
--- a/target/m68k/Kconfig
+++ b/target/m68k/Kconfig
@@ -1,3 +1,4 @@ 
 config M68K
     bool
+    select M68K_DIS
     imply SEMIHOSTING if TCG
diff --git a/target/microblaze/Kconfig b/target/microblaze/Kconfig
index e91d58d88f2..09525a8e3ff 100644
--- a/target/microblaze/Kconfig
+++ b/target/microblaze/Kconfig
@@ -1,3 +1,4 @@ 
 config MICROBLAZE
     bool
+    select MICROBLAZE_DIS
     select DEVICE_TREE # needed by boot.c
diff --git a/target/mips/Kconfig b/target/mips/Kconfig
index 876048b150c..74a220f410a 100644
--- a/target/mips/Kconfig
+++ b/target/mips/Kconfig
@@ -1,5 +1,6 @@ 
 config MIPS
     bool
+    select MIPS_DIS
     imply SEMIHOSTING if TCG
 
 config MIPS64
diff --git a/target/openrisc/Kconfig b/target/openrisc/Kconfig
index cd66c2e3b6c..7e3c092345c 100644
--- a/target/openrisc/Kconfig
+++ b/target/openrisc/Kconfig
@@ -1,3 +1,4 @@ 
 config OPENRISC
     bool
+    select OPENRISC_DIS
     select DEVICE_TREE # needed by boot.c
diff --git a/target/ppc/Kconfig b/target/ppc/Kconfig
index 0283711673e..930337c4422 100644
--- a/target/ppc/Kconfig
+++ b/target/ppc/Kconfig
@@ -1,5 +1,6 @@ 
 config PPC
     bool
+    select PPC_DIS
 
 config PPC64
     bool
diff --git a/target/riscv/Kconfig b/target/riscv/Kconfig
index 11bc09b4146..f5cf6185a88 100644
--- a/target/riscv/Kconfig
+++ b/target/riscv/Kconfig
@@ -1,9 +1,11 @@ 
 config RISCV32
     bool
+    select RISCV_DIS
     select ARM_COMPATIBLE_SEMIHOSTING if TCG
     select DEVICE_TREE # needed by boot.c
 
 config RISCV64
     bool
+    select RISCV_DIS
     select ARM_COMPATIBLE_SEMIHOSTING if TCG
     select DEVICE_TREE # needed by boot.c
diff --git a/target/rx/Kconfig b/target/rx/Kconfig
index aceb5ed28fe..c050315add7 100644
--- a/target/rx/Kconfig
+++ b/target/rx/Kconfig
@@ -1,2 +1,3 @@ 
 config RX
     bool
+    select RX_DIS
diff --git a/target/s390x/Kconfig b/target/s390x/Kconfig
index 8a95f2bc3ff..51bb0afa446 100644
--- a/target/s390x/Kconfig
+++ b/target/s390x/Kconfig
@@ -1,5 +1,6 @@ 
 config S390X
     bool
+    select S390_DIS
     select PCI
     select S390_FLIC
 
diff --git a/target/sh4/Kconfig b/target/sh4/Kconfig
index 93b92f1e480..6ecf3173361 100644
--- a/target/sh4/Kconfig
+++ b/target/sh4/Kconfig
@@ -1,4 +1,5 @@ 
 config SH4
     bool
+    select SH4_DIS
     # needed for sh_intc_get_pending_vector
     select SH_INTC
diff --git a/target/sparc/Kconfig b/target/sparc/Kconfig
index 70cc0f3a210..bcb53d964f0 100644
--- a/target/sparc/Kconfig
+++ b/target/sparc/Kconfig
@@ -1,5 +1,7 @@ 
 config SPARC
     bool
+    select SPARC_DIS
 
 config SPARC64
     bool
+    select SPARC_DIS
diff --git a/target/tricore/Kconfig b/target/tricore/Kconfig
index 93134093093..c7c5fa8b074 100644
--- a/target/tricore/Kconfig
+++ b/target/tricore/Kconfig
@@ -1,2 +1,3 @@ 
 config TRICORE
     bool
+    select TRICORE_DIS
diff --git a/target/xtensa/Kconfig b/target/xtensa/Kconfig
index e8c2598c4d9..d54e3523401 100644
--- a/target/xtensa/Kconfig
+++ b/target/xtensa/Kconfig
@@ -1,3 +1,4 @@ 
 config XTENSA
     bool
     imply SEMIHOSTING if TCG
+    select XTENSA_DIS