On 5/5/26 17:48, Pierrick Bouvier wrote:
Instead of using a static constructor, delay registering those types
until we call module_init(MODULE_INIT_QOM).

This is not yet a problem, but since we will start initializing
target-info types before any other, without this patch
qemu-system-xtensa* fails with:
Type 'dsp3400-xtensa-cpu' is missing its parent 'xtensa-cpu'

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Pierrick Bouvier <[email protected]>
---
  target/xtensa/overlay_tool.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h
index 701c00eed20..b9eaffa4871 100644
--- a/target/xtensa/overlay_tool.h
+++ b/target/xtensa/overlay_tool.h
@@ -451,13 +451,14 @@
#if TARGET_BIG_ENDIAN == (XCHAL_HAVE_BE != 0)
  #define REGISTER_CORE(core) \
-    static void __attribute__((constructor)) register_core(void) \
+    static void register_core(void) \
      { \
          static XtensaConfigList node = { \
              .config = &core, \
          }; \
          xtensa_register_core(&node); \
-    }
+    } \
+    type_init(register_core)
  #else
  #define REGISTER_CORE(core)
  #endif

Reviewed-by: Richard Henderson <[email protected]>

r~

Reply via email to