[PATCH-for-12.0 0/8] linux-user/aarch64: Support both endianness at runtime

Philippe Mathieu-Daudé posted 8 patches 59 minutes ago
There is a newer version of this series
docs/about/deprecated.rst                 | 13 ++++++++
docs/user/main.rst                        |  7 ++++
configs/targets/aarch64-linux-user.mak    |  2 ++
configs/targets/aarch64_be-linux-user.mak | 10 ------
meson.build                               | 39 +++++++++++++++++++++--
include/exec/tswap.h                      | 11 ++++---
include/qemu/target-info-def.h            | 14 ++++++++
include/qemu/target-info.h                | 20 ++++++++++++
linux-user/aarch64/target_elf.h           |  6 +---
linux-user/aarch64/target_syscall.h       |  6 +---
linux-user/arm/target_proc.h              |  2 +-
linux-user/qemu.h                         | 17 +++++++++-
linux-user/syscall_defs.h                 |  7 ----
target/arm/internals.h                    |  2 +-
linux-user/aarch64/cpu_loop.c             | 12 +++----
linux-user/aarch64/elfload.c              | 10 +++++-
linux-user/aarch64/signal.c               | 20 ++++--------
linux-user/elfload.c                      |  6 +---
linux-user/main.c                         | 26 +++++++++++++++
linux-user/syscall.c                      |  6 ++--
target-info-def.c                         | 19 +++++++++++
target/arm/gdbstub64.c                    |  4 +--
target/arm/tcg/translate-sve.c            |  2 +-
tests/tcg/aarch64_be/hello.c              | 11 ++++---
.gitlab-ci.d/buildtest.yml                |  2 +-
.gitlab-ci.d/crossbuild-template.yml      |  4 +--
linux-user/aarch64/meson.build            | 10 +++---
tests/tcg/aarch64_be/meson.build          |  4 +--
28 files changed, 208 insertions(+), 84 deletions(-)
delete mode 100644 configs/targets/aarch64_be-linux-user.mak
[PATCH-for-12.0 0/8] linux-user/aarch64: Support both endianness at runtime
Posted by Philippe Mathieu-Daudé 59 minutes ago
This series lets qemu-aarch64 run both little- and big-endian
ELF binaries, retaining qemu-aarch64_be as a compatibility alias.

The ELF loader selects the target byte order once, before execution.
AArch64 CPU, signal, ABI and vDSO handling then use that selection.
Fixed-endian targets and system emulation retain their existing
accessors.

Runtime-endian TargetInfo data is exposed const to readers, allowing
target_big_endian() to be inlined without a separate boolean cache.
The writable initializer remains outside LTO, preserving the boundary
between ELF initialization and subsequent reads.

I compared the complete series against its baseline, with normal and
LTO builds and LE/BE guests and did not notice significative speed
down.

The inspiration comes from previous optimization intent from Richard:
https://lore.kernel.org/qemu-devel/20260511190634.472174-1-richard.henderson@linaro.org/

Philippe Mathieu-Daudé (8):
  tests/tcg/aarch64_be: Check data byte order in hello
  linux-user/aarch64: Move ELF/vDSO endian checks to runtime
  linux-user/aarch64: Move CPU/signal endian checks to runtime
  target-info: Support runtime-endian Linux-user targets
  linux-user: Honor runtime byte order in ABI accesses
  linux-user: Select target byte order from the ELF header
  meson: Support Linux-user executable aliases
  linux-user/aarch64: Unify both byte orders under qemu-aarch64

 docs/about/deprecated.rst                 | 13 ++++++++
 docs/user/main.rst                        |  7 ++++
 configs/targets/aarch64-linux-user.mak    |  2 ++
 configs/targets/aarch64_be-linux-user.mak | 10 ------
 meson.build                               | 39 +++++++++++++++++++++--
 include/exec/tswap.h                      | 11 ++++---
 include/qemu/target-info-def.h            | 14 ++++++++
 include/qemu/target-info.h                | 20 ++++++++++++
 linux-user/aarch64/target_elf.h           |  6 +---
 linux-user/aarch64/target_syscall.h       |  6 +---
 linux-user/arm/target_proc.h              |  2 +-
 linux-user/qemu.h                         | 17 +++++++++-
 linux-user/syscall_defs.h                 |  7 ----
 target/arm/internals.h                    |  2 +-
 linux-user/aarch64/cpu_loop.c             | 12 +++----
 linux-user/aarch64/elfload.c              | 10 +++++-
 linux-user/aarch64/signal.c               | 20 ++++--------
 linux-user/elfload.c                      |  6 +---
 linux-user/main.c                         | 26 +++++++++++++++
 linux-user/syscall.c                      |  6 ++--
 target-info-def.c                         | 19 +++++++++++
 target/arm/gdbstub64.c                    |  4 +--
 target/arm/tcg/translate-sve.c            |  2 +-
 tests/tcg/aarch64_be/hello.c              | 11 ++++---
 .gitlab-ci.d/buildtest.yml                |  2 +-
 .gitlab-ci.d/crossbuild-template.yml      |  4 +--
 linux-user/aarch64/meson.build            | 10 +++---
 tests/tcg/aarch64_be/meson.build          |  4 +--
 28 files changed, 208 insertions(+), 84 deletions(-)
 delete mode 100644 configs/targets/aarch64_be-linux-user.mak

-- 
2.55.0