On 5/20/25 14:51, Kohei Tokunaga wrote:
    target_kconfig = []
    foreach sym: accelerators
-    # Disallow 64-bit on 32-bit emulation and virtualization
-    if host_long_bits < config_target['TARGET_LONG_BITS'].to_int()
-      continue
+    if host_arch != 'wasm32'
+      # Disallow 64-bit on 32-bit emulation and virtualization
+      if host_long_bits < config_target['TARGET_LONG_BITS'].to_int()
+        continue
+      endif
      endif
      if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
        config_target += { sym: 'y' }

I'd prefer something like

# Detect host pointer size for the target configuration loop.
host_long_bits = cc.sizeof('void *') * 8
tcg_vaddr_bits = host_arch == 'wasm32' ? 64 : host_long_bits
...
config_host_data.set('TCG_VADDR_BITS', tcg_vaddr_bits)

Then in the target configuration loop

-    if host_long_bits < config_target['TARGET_LONG_BITS'].to_int()
+    if tcg_vaddr_bits < config_target['TARGET_LONG_BITS'].to_int()

and throughout the code you can have

#ifdef TCG_VADDR_BITS == 32
...
#else
...
#endif

instead of

#ifdef EMSCRIPTEN
...
#else
...
#endif

In fact, I think this patch would be acceptable as a separate submission, because it could be tested using TCI already.

Paolo


Reply via email to