[RFC PATCH 0/5] target/tcg: Rename some helpers common to various targets

Philippe Mathieu-Daudé posted 5 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260224193028.2370-1-philmd@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Brian Cain <brian.cain@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Song Gao <gaosong@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
target/arm/tcg/helper-a64-defs.h                 |  2 +-
target/arm/tcg/helper-defs.h                     |  4 ++--
target/hexagon/gen_tcg.h                         |  2 +-
target/hexagon/helper.h                          |  2 +-
target/i386/helper.h                             |  2 +-
target/i386/ops_sse.h                            |  2 +-
target/loongarch/tcg/helper.h                    |  8 ++++----
target/m68k/helper.h                             |  2 +-
target/microblaze/helper.h                       |  4 ++--
target/mips/helper.h                             |  6 +++---
target/ppc/helper.h                              |  2 +-
target/riscv/helper.h                            |  2 +-
target/sparc/helper.h                            |  2 +-
target/i386/tcg/ops_sse_header.h.inc             |  2 +-
target/arm/tcg/arith_helper.c                    |  4 ++--
target/arm/tcg/helper-a64.c                      |  4 ++--
target/arm/tcg/translate-a64.c                   |  4 ++--
target/arm/tcg/translate.c                       |  4 ++--
target/hexagon/op_helper.c                       |  2 +-
target/hexagon/translate.c                       |  2 +-
target/i386/tcg/excp_helper.c                    |  2 +-
target/i386/tcg/translate.c                      |  2 +-
target/loongarch/tcg/fpu_helper.c                |  2 +-
target/loongarch/tcg/op_helper.c                 |  6 +++---
target/m68k/op_helper.c                          |  2 +-
target/m68k/translate.c                          |  2 +-
target/microblaze/helper.c                       |  2 +-
target/microblaze/op_helper.c                    |  2 +-
target/microblaze/translate.c                    |  4 ++--
target/mips/tcg/op_helper.c                      |  6 +++---
target/mips/tcg/translate.c                      |  6 +++---
target/ppc/tcg-excp_helper.c                     |  2 +-
target/ppc/translate.c                           |  6 +++---
target/riscv/fpu_helper.c                        |  2 +-
target/riscv/translate.c                         |  2 +-
target/sparc/helper.c                            |  2 +-
target/sparc/translate.c                         |  6 +++---
target/i386/tcg/emit.c.inc                       |  2 +-
target/loongarch/tcg/insn_trans/trans_bit.c.inc  |  4 ++--
.../loongarch/tcg/insn_trans/trans_extra.c.inc   | 16 ++++++++--------
target/loongarch/tcg/insn_trans/trans_fmov.c.inc |  2 +-
41 files changed, 71 insertions(+), 71 deletions(-)
[RFC PATCH 0/5] target/tcg: Rename some helpers common to various targets
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
TCG helpers are declared using the DEF_HELPER*() macros
which imply global symbol scope. Unfortunately when building
a single binary (containing multiple TCG 'target' frontends)
these symbols clash.

This series takes the dumbest approach, renaming the symbols.

There are still around 20 symbol clashes (usually FPU helpers),
but this series is good for my proof-of-concept.

Philippe Mathieu-Daudé (5):
  target/tcg: Rename bitswap() helpers
  target/tcg: Rename crc32*() helpers
  target/tcg: Rename unaligned_access() helpers
  target/tcg: Rename raise_exception() helpers
  target/tcg: Rename set_rounding_mode() helpers

 target/arm/tcg/helper-a64-defs.h                 |  2 +-
 target/arm/tcg/helper-defs.h                     |  4 ++--
 target/hexagon/gen_tcg.h                         |  2 +-
 target/hexagon/helper.h                          |  2 +-
 target/i386/helper.h                             |  2 +-
 target/i386/ops_sse.h                            |  2 +-
 target/loongarch/tcg/helper.h                    |  8 ++++----
 target/m68k/helper.h                             |  2 +-
 target/microblaze/helper.h                       |  4 ++--
 target/mips/helper.h                             |  6 +++---
 target/ppc/helper.h                              |  2 +-
 target/riscv/helper.h                            |  2 +-
 target/sparc/helper.h                            |  2 +-
 target/i386/tcg/ops_sse_header.h.inc             |  2 +-
 target/arm/tcg/arith_helper.c                    |  4 ++--
 target/arm/tcg/helper-a64.c                      |  4 ++--
 target/arm/tcg/translate-a64.c                   |  4 ++--
 target/arm/tcg/translate.c                       |  4 ++--
 target/hexagon/op_helper.c                       |  2 +-
 target/hexagon/translate.c                       |  2 +-
 target/i386/tcg/excp_helper.c                    |  2 +-
 target/i386/tcg/translate.c                      |  2 +-
 target/loongarch/tcg/fpu_helper.c                |  2 +-
 target/loongarch/tcg/op_helper.c                 |  6 +++---
 target/m68k/op_helper.c                          |  2 +-
 target/m68k/translate.c                          |  2 +-
 target/microblaze/helper.c                       |  2 +-
 target/microblaze/op_helper.c                    |  2 +-
 target/microblaze/translate.c                    |  4 ++--
 target/mips/tcg/op_helper.c                      |  6 +++---
 target/mips/tcg/translate.c                      |  6 +++---
 target/ppc/tcg-excp_helper.c                     |  2 +-
 target/ppc/translate.c                           |  6 +++---
 target/riscv/fpu_helper.c                        |  2 +-
 target/riscv/translate.c                         |  2 +-
 target/sparc/helper.c                            |  2 +-
 target/sparc/translate.c                         |  6 +++---
 target/i386/tcg/emit.c.inc                       |  2 +-
 target/loongarch/tcg/insn_trans/trans_bit.c.inc  |  4 ++--
 .../loongarch/tcg/insn_trans/trans_extra.c.inc   | 16 ++++++++--------
 target/loongarch/tcg/insn_trans/trans_fmov.c.inc |  2 +-
 41 files changed, 71 insertions(+), 71 deletions(-)

-- 
2.52.0


Re: [RFC PATCH 0/5] target/tcg: Rename some helpers common to various targets
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 2/24/26 11:30 AM, Philippe Mathieu-Daudé wrote:
> TCG helpers are declared using the DEF_HELPER*() macros
> which imply global symbol scope. Unfortunately when building
> a single binary (containing multiple TCG 'target' frontends)
> these symbols clash.
> 
> This series takes the dumbest approach, renaming the symbols.
> 
> There are still around 20 symbol clashes (usually FPU helpers),
> but this series is good for my proof-of-concept.
> 
> Philippe Mathieu-Daudé (5):
>    target/tcg: Rename bitswap() helpers
>    target/tcg: Rename crc32*() helpers
>    target/tcg: Rename unaligned_access() helpers
>    target/tcg: Rename raise_exception() helpers
>    target/tcg: Rename set_rounding_mode() helpers
> 
>   target/arm/tcg/helper-a64-defs.h                 |  2 +-
>   target/arm/tcg/helper-defs.h                     |  4 ++--
>   target/hexagon/gen_tcg.h                         |  2 +-
>   target/hexagon/helper.h                          |  2 +-
>   target/i386/helper.h                             |  2 +-
>   target/i386/ops_sse.h                            |  2 +-
>   target/loongarch/tcg/helper.h                    |  8 ++++----
>   target/m68k/helper.h                             |  2 +-
>   target/microblaze/helper.h                       |  4 ++--
>   target/mips/helper.h                             |  6 +++---
>   target/ppc/helper.h                              |  2 +-
>   target/riscv/helper.h                            |  2 +-
>   target/sparc/helper.h                            |  2 +-
>   target/i386/tcg/ops_sse_header.h.inc             |  2 +-
>   target/arm/tcg/arith_helper.c                    |  4 ++--
>   target/arm/tcg/helper-a64.c                      |  4 ++--
>   target/arm/tcg/translate-a64.c                   |  4 ++--
>   target/arm/tcg/translate.c                       |  4 ++--
>   target/hexagon/op_helper.c                       |  2 +-
>   target/hexagon/translate.c                       |  2 +-
>   target/i386/tcg/excp_helper.c                    |  2 +-
>   target/i386/tcg/translate.c                      |  2 +-
>   target/loongarch/tcg/fpu_helper.c                |  2 +-
>   target/loongarch/tcg/op_helper.c                 |  6 +++---
>   target/m68k/op_helper.c                          |  2 +-
>   target/m68k/translate.c                          |  2 +-
>   target/microblaze/helper.c                       |  2 +-
>   target/microblaze/op_helper.c                    |  2 +-
>   target/microblaze/translate.c                    |  4 ++--
>   target/mips/tcg/op_helper.c                      |  6 +++---
>   target/mips/tcg/translate.c                      |  6 +++---
>   target/ppc/tcg-excp_helper.c                     |  2 +-
>   target/ppc/translate.c                           |  6 +++---
>   target/riscv/fpu_helper.c                        |  2 +-
>   target/riscv/translate.c                         |  2 +-
>   target/sparc/helper.c                            |  2 +-
>   target/sparc/translate.c                         |  6 +++---
>   target/i386/tcg/emit.c.inc                       |  2 +-
>   target/loongarch/tcg/insn_trans/trans_bit.c.inc  |  4 ++--
>   .../loongarch/tcg/insn_trans/trans_extra.c.inc   | 16 ++++++++--------
>   target/loongarch/tcg/insn_trans/trans_fmov.c.inc |  2 +-
>   41 files changed, 71 insertions(+), 71 deletions(-)
> 

It seems to be the best and easiest way to deal with it.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Re: [RFC PATCH 0/5] target/tcg: Rename some helpers common to various targets
Posted by Brian Cain 1 month, 2 weeks ago
On Tue, Feb 24, 2026 at 1:32 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> TCG helpers are declared using the DEF_HELPER*() macros
> which imply global symbol scope. Unfortunately when building
> a single binary (containing multiple TCG 'target' frontends)
> these symbols clash.
>
> This series takes the dumbest approach, renaming the symbols.
>
> There are still around 20 symbol clashes (usually FPU helpers),
> but this series is good for my proof-of-concept.
>
> Philippe Mathieu-Daudé (5):
>   target/tcg: Rename bitswap() helpers
>   target/tcg: Rename crc32*() helpers
>   target/tcg: Rename unaligned_access() helpers
>   target/tcg: Rename raise_exception() helpers
>   target/tcg: Rename set_rounding_mode() helpers
>
>  target/arm/tcg/helper-a64-defs.h                 |  2 +-
>  target/arm/tcg/helper-defs.h                     |  4 ++--
>  target/hexagon/gen_tcg.h                         |  2 +-
>  target/hexagon/helper.h                          |  2 +-
>  target/i386/helper.h                             |  2 +-
>  target/i386/ops_sse.h                            |  2 +-
>  target/loongarch/tcg/helper.h                    |  8 ++++----
>  target/m68k/helper.h                             |  2 +-
>  target/microblaze/helper.h                       |  4 ++--
>  target/mips/helper.h                             |  6 +++---
>  target/ppc/helper.h                              |  2 +-
>  target/riscv/helper.h                            |  2 +-
>  target/sparc/helper.h                            |  2 +-
>  target/i386/tcg/ops_sse_header.h.inc             |  2 +-
>  target/arm/tcg/arith_helper.c                    |  4 ++--
>  target/arm/tcg/helper-a64.c                      |  4 ++--
>  target/arm/tcg/translate-a64.c                   |  4 ++--
>  target/arm/tcg/translate.c                       |  4 ++--
>  target/hexagon/op_helper.c                       |  2 +-
>  target/hexagon/translate.c                       |  2 +-
>  target/i386/tcg/excp_helper.c                    |  2 +-
>  target/i386/tcg/translate.c                      |  2 +-
>  target/loongarch/tcg/fpu_helper.c                |  2 +-
>  target/loongarch/tcg/op_helper.c                 |  6 +++---
>  target/m68k/op_helper.c                          |  2 +-
>  target/m68k/translate.c                          |  2 +-
>  target/microblaze/helper.c                       |  2 +-
>  target/microblaze/op_helper.c                    |  2 +-
>  target/microblaze/translate.c                    |  4 ++--
>  target/mips/tcg/op_helper.c                      |  6 +++---
>  target/mips/tcg/translate.c                      |  6 +++---
>  target/ppc/tcg-excp_helper.c                     |  2 +-
>  target/ppc/translate.c                           |  6 +++---
>  target/riscv/fpu_helper.c                        |  2 +-
>  target/riscv/translate.c                         |  2 +-
>  target/sparc/helper.c                            |  2 +-
>  target/sparc/translate.c                         |  6 +++---
>  target/i386/tcg/emit.c.inc                       |  2 +-
>  target/loongarch/tcg/insn_trans/trans_bit.c.inc  |  4 ++--
>  .../loongarch/tcg/insn_trans/trans_extra.c.inc   | 16 ++++++++--------
>  target/loongarch/tcg/insn_trans/trans_fmov.c.inc |  2 +-
>  41 files changed, 71 insertions(+), 71 deletions(-)
>
>
For hexagon - those renames seem fine/appropriate.

Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>



> --
> 2.52.0
>
>
>