When linking multiple targets together, we usually have conflicts with helper names. So far, it was solved using ad-hoc renaming, but multiple people pointed it would be better to have a general mechanism for it, so here it is.
A previous series attempted that: https://lore.kernel.org/qemu-devel/[email protected]/, but it was relying on (binary) symbol renaming, which is not a portable solution. Instead, this series approaches the problem from source code directly. It requires more change, but it's cleaner IMHO. Series follows these steps: First, we make sure all helpers and definition are using HELPER() macro. A lot of helpers were already defined this way, we just make sure it's exhaustive. After that we don't have any 'helper_' left on any target code. This is a big change touching the whole codebase, but it's a simple mechanical change. As long as it compiles and links, we know it's correct. Then, we introduce the prefix for target helpers. For this , we add a new define (from meson) that applies to all target related code. It could later be used to prefix other symbols also, that's why it's not named "TCG". Finally, we cleanup the previous manual helpers prefix that were added in codebase. Pierrick Bouvier (26): target/alpha: define and call helpers using HELPER macro target/arm: define and call helpers using HELPER macro target/avr: define and call helpers using HELPER macro target/hppa: define and call helpers using HELPER macro target/i386: define and call helpers using HELPER macro target/loongarch: define and call helpers using HELPER macro target/m68k: define and call helpers using HELPER macro target/microblaze: define and call helpers using HELPER macro target/mips: define and call helpers using HELPER macro target/or1k: define and call helpers using HELPER macro target/ppc: define and call helpers using HELPER macro target/riscv: define and call helpers using HELPER macro target/rx: define and call helpers using HELPER macro target/s390x: define and call helpers using HELPER macro target/sh4: define and call helpers using HELPER macro target/sparc: define and call helpers using HELPER macro target/tricore: define and call helpers using HELPER macro tcg: introduce HELPER_INFO macro tcg: prefix helpers with target base architecture target/alpha: remove explicit target specific prefix target/hexagon: remove explicit target specific prefix target/hppa: remove explicit target specific prefix target/microblaze: remove explicit target specific prefix target/or1k: remove explicit target specific prefix target/rx: remove explicit target specific prefix target/tricore: remove explicit target specific prefix include/exec/helper-gen-common.h | 7 + include/exec/helper-gen.h.inc | 48 +- include/exec/helper-head.h.inc | 8 +- include/exec/helper-info.c.inc | 16 +- include/exec/helper-proto-common.h | 7 + meson.build | 2 + target/alpha/clk_helper.c | 2 +- target/alpha/fpu_helper.c | 60 +-- target/alpha/helper.c | 6 +- target/alpha/helper.h | 2 +- target/alpha/int_helper.c | 38 +- target/alpha/sys_helper.c | 12 +- target/alpha/translate.c | 4 +- target/alpha/vax_helper.c | 42 +- target/arm/tcg/helper-a64.c | 6 +- target/arm/tcg/mve_helper.c | 28 +- target/arm/tcg/psci.c | 2 +- target/arm/tcg/sme_helper.c | 4 +- target/arm/tcg/sve_helper.c | 141 ++--- target/arm/tcg/tlb_helper.c | 2 +- target/arm/tcg/vec_helper.c | 72 +-- target/arm/tcg/vec_helper64.c | 64 +-- target/arm/tcg/vec_internal.h | 5 +- target/avr/helper.c | 12 +- target/hexagon/gen_tcg.h | 2 +- target/hexagon/gen_tcg_sys.h | 2 +- target/hexagon/helper.h | 4 +- target/hexagon/op_helper.c | 4 +- target/hexagon/translate.c | 4 +- target/hppa/fpu_helper.c | 2 +- target/hppa/helper.h | 6 +- target/hppa/op_helper.c | 4 +- target/hppa/sys_helper.c | 10 +- target/hppa/translate.c | 6 +- target/i386/ops_sse.h | 401 +++++++------- target/i386/tcg/bpt_helper.c | 6 +- target/i386/tcg/cc_helper.c | 14 +- target/i386/tcg/excp_helper.c | 8 +- target/i386/tcg/fpu_helper.c | 182 +++---- target/i386/tcg/int_helper.c | 34 +- target/i386/tcg/mem_helper.c | 4 +- target/i386/tcg/misc_helper.c | 16 +- target/i386/tcg/mpx_helper.c | 12 +- target/i386/tcg/seg_helper.c | 32 +- target/i386/tcg/system/bpt_helper.c | 6 +- target/i386/tcg/system/misc_helper.c | 32 +- target/i386/tcg/system/seg_helper.c | 4 +- target/i386/tcg/system/smm_helper.c | 12 +- target/i386/tcg/system/svm_helper.c | 16 +- target/i386/tcg/user/seg_helper.c | 4 +- target/loongarch/tcg/csr_helper.c | 22 +- target/loongarch/tcg/fpu_helper.c | 126 ++--- target/loongarch/tcg/iocsr_helper.c | 16 +- target/loongarch/tcg/op_helper.c | 18 +- target/loongarch/tcg/tlb_helper.c | 26 +- target/loongarch/tcg/vec_helper.c | 4 +- target/m68k/op_helper.c | 2 +- target/microblaze/helper.h | 10 +- target/microblaze/op_helper.c | 46 +- target/microblaze/translate.c | 10 +- target/mips/tcg/dsp_helper.c | 187 +++---- target/mips/tcg/exception.c | 8 +- target/mips/tcg/fpu_helper.c | 291 +++++----- target/mips/tcg/ldst_helper.c | 18 +- target/mips/tcg/lmmi_helper.c | 98 ++-- target/mips/tcg/msa_helper.c | 690 ++++++++++++------------ target/mips/tcg/octeon_crypto.c | 100 ++-- target/mips/tcg/op_helper.c | 34 +- target/mips/tcg/system/cp0_helper.c | 276 +++++----- target/mips/tcg/system/lcsr_helper.c | 8 +- target/mips/tcg/system/special_helper.c | 12 +- target/mips/tcg/system/tlb_helper.c | 14 +- target/mips/tcg/vr54xx_helper.c | 30 +- target/or1k/fpu_helper.c | 16 +- target/or1k/helper.h | 2 +- target/or1k/interrupt_helper.c | 2 +- target/or1k/translate.c | 2 +- target/ppc/dfp_helper.c | 52 +- target/ppc/fpu_helper.c | 396 +++++++------- target/ppc/int_helper.c | 292 +++++----- target/ppc/internal.h | 7 +- target/ppc/mem_helper.c | 28 +- target/ppc/misc_helper.c | 56 +- target/ppc/mmu-hash64.c | 18 +- target/ppc/mmu_helper.c | 70 +-- target/ppc/power8-pmu.c | 14 +- target/ppc/tcg-excp_helper.c | 56 +- target/ppc/timebase_helper.c | 54 +- target/ppc/translate/vsx-impl.c.inc | 2 +- target/riscv/tcg/debug.c | 2 +- target/riscv/tcg/fpu_helper.c | 196 +++---- target/riscv/tcg/op_helper.c | 74 +-- target/rx/helper.h | 12 +- target/rx/op_helper.c | 62 +-- target/rx/translate.c | 14 +- target/s390x/tcg/mem_helper.c | 2 +- target/sh4/op_helper.c | 76 +-- target/sparc/fop_helper.c | 106 ++-- target/sparc/helper.c | 22 +- target/sparc/int64_helper.c | 6 +- target/sparc/ldst_helper.c | 14 +- target/sparc/vis_helper.c | 94 ++-- target/sparc/win_helper.c | 38 +- target/tricore/fpu_helper.c | 32 +- target/tricore/helper.h | 14 +- target/tricore/op_helper.c | 220 ++++---- target/tricore/translate.c | 14 +- 107 files changed, 2789 insertions(+), 2739 deletions(-) -- 2.43.0
