In next commit, we'll apply same helper pattern for base helpers
remaining.

Our new helper pattern always include helper-*-common.h, which ends up
including include/tcg/tcg.h, which contains one occurrence of
CONFIG_USER_ONLY.
Thus, common files not being duplicated between system and target
relying on helpers will fail to compile. Existing occurrences are:
- target/arm/tcg/arith_helper.c
- target/arm/tcg/crypto_helper.c

There is a single occurrence of CONFIG_USER_ONLY, for defining variable
tcg_use_softmmu. The fix seemed simple, always define it.
However, it prevents some dead code elimination which ends up triggering:
include/qemu/osdep.h:283:35: error: call to 'qemu_build_not_reached_always' 
declared with attribute error: code path is reachable
  283 | #define qemu_build_not_reached()  qemu_build_not_reached_always()
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcg/x86_64/tcg-target.c.inc:1907:45: note: in expansion of macro 
'qemu_build_not_reached'
 1907 | # define x86_guest_base (*(HostAddress *)({ qemu_build_not_reached(); 
NULL; }))
      |                                             ^~~~~~~~~~~~~~~~~~~~~~
tcg/x86_64/tcg-target.c.inc:1934:14: note: in expansion of macro 
'x86_guest_base'
 1934 |         *h = x86_guest_base;
      |              ^~~~~~~~~~~~~~

So, roll your eyes, then rollback code, and simply duplicate the two
files concerned. We could also do a "special include trick" to prevent
pulling helper-*-common.h but it would be sad since the whole point of
the series up to here is to have something coherent using the exact same
pattern.

Signed-off-by: Pierrick Bouvier <[email protected]>
---
 target/arm/tcg/meson.build | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index 1b115656c46..41cf9bad4f1 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -58,20 +58,20 @@ arm_user_ss.add(when: 'TARGET_AARCH64', if_false: 
files('cpu-v7m.c'))
 
 arm_common_ss.add(zlib)
 
-arm_common_ss.add(files(
-  'arith_helper.c',
-  'crypto_helper.c',
-))
-
 arm_common_system_ss.add(files(
+  'arith_helper.c',
+  'crypto_helper.c',
   'cpregs-at.c',
   'hflags.c',
   'neon_helper.c',
   'tlb_helper.c',
   'tlb-insns.c',
   'vfp_helper.c',
+  'crypto_helper.c',
 ))
 arm_user_ss.add(files(
+  'arith_helper.c',
+  'crypto_helper.c',
   'hflags.c',
   'neon_helper.c',
   'tlb_helper.c',
-- 
2.47.3


Reply via email to