On 3/18/25 14:31, Richard Henderson wrote:
Avoid testing CONFIG_USER_ONLY in semihost.h.
The only function that's required is semihosting_enabled.

Signed-off-by: Richard Henderson <richard.hender...@linaro.org>

This breaks bsd-user,

CONFIG_SEMIHOSTING is not defined in configs/targets/*bsd-user*, thus
the user stub is not included.
Since in user mode we always return true, we can simply add the stub
inconditionnally for all the user binaries.

See here for details and a patch fixing it [1] (also attached to this email).

[1] https://github.com/pbo-linaro/qemu/commit/d105112e11e521ff82b328be5f8fdc2af38aa75b

Regards,
Pierrick
From d105112e11e521ff82b328be5f8fdc2af38aa75b Mon Sep 17 00:00:00 2001
From: Pierrick Bouvier <pierrick.bouv...@linaro.org>
Date: Mon, 31 Mar 2025 14:39:30 -0700
Subject: [PATCH] FIX semihosting: always include user definition for
 semihosting_enabled

CONFIG_SEMIHOSTING is not defined in configs/targets/*bsd-user*, thus
the user stub is not included.
Since in user mode we always return true, we can simply add the stub
inconditionnally for all the user binaries.

ld: error: undefined symbol: semihosting_enabled
>>> referenced by translate-a64.c:2855
>>> libqemu-aarch64-bsd-user.a.p/target_arm_tcg_translate-a64.c.o
>>> referenced by translate.c:1138
>>> libqemu-aarch64-bsd-user.a.p/target_arm_tcg_translate.c.o
>>> referenced by translate.c:4814
>>> libqemu-aarch64-bsd-user.a.p/target_arm_tcg_translate.c.o

Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
---
 semihosting/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/semihosting/meson.build b/semihosting/meson.build
index ab67f87e4f0..1f5cfb3ba72 100644
--- a/semihosting/meson.build
+++ b/semihosting/meson.build
@@ -15,7 +15,7 @@ system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_true: files(
   'stubs-system.c',
 ))
 
-user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c'))
+user_ss.add(files('user.c'))
 
 specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'],
 		if_true: files('arm-compat-semi.c'))
-- 
2.39.5

Reply via email to