Commit 6b736f6dd3 for qemu.org

commit 6b736f6dd361d23e64efebece7594e317e0e36cf
Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Date:   Wed Oct 7 18:46:10 2026 +0000

    meson.build: export TARGET_ARCH_VARIANT in target config

    For now, TARGET_ARCH only contains 32 vs 64 bit arch. The variants,
    based on endianness, are accessible through TARGET_NAME. However,
    TARGET_NAME is a string, and thus can't be concatenated to generate code
    and retrieve matching SYS_EMU_TARGET enum entry.
    Thus, export this information in TARGET_ARCH_VARIANT as an unquoted
    identifier.

    There is one more subtlety, user binaries have extra targets that are
    not present in SYS_EMU_TARGET, like armeb.
    Thus, for user binaries, simply export TARGET_ARCH.

    Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Suggested-by: Yonggang Luo <luoyonggang@gmail.com>
    Link: https://lore.kernel.org/qemu-devel/20261007184612.24073-2-pierrick.bouvier@oss.qualcomm.com
    Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

diff --git a/meson.build b/meson.build
index 828100de81..48da6cf3e6 100644
--- a/meson.build
+++ b/meson.build
@@ -3288,7 +3288,14 @@ default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
 actual_target_dirs = []
 fdt_required = []
 foreach target : target_dirs
-  config_target = { 'TARGET_NAME': target.split('-')[0] }
+  target_name = target.split('-')[0]
+  config_target = { 'TARGET_NAME': target_name }
+  if target.endswith('linux-user')
+    config_target += { 'TARGET_ARCH_VARIANT': 'TARGET_ARCH' }
+  else
+    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
+  endif
+
   if target.endswith('linux-user')
     if host_os != 'linux'
       if default_targets
@@ -3372,7 +3379,7 @@ foreach target : target_dirs
       # do nothing
     elif ignored.contains(k)
       # do nothing
-    elif k == 'TARGET_ARCH'
+    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
       config_target_data.set(k, v.to_upper())
     elif k == 'TARGET_BASE_ARCH'
       # Note that TARGET_BASE_ARCH ends up in config-target.h but it is