@samitouri / QOSamiQemu / commits / b81e0e2a26

target/xtensa/core: register types using type_init

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é <philmd@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Message-ID: <20260430203842.29156-4-pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Pierrick Bouvier committed Apr 30, 2026 at 01:56 UTC b81e0e2a26308cf54bc4afdcb00648a52882f431
1 file changed +3 -2
target/xtensa/overlay_tool.h
+3 -2
@@ -451,13 +451,14 @@
451
452 #if TARGET_BIG_ENDIAN == (XCHAL_HAVE_BE != 0)
453 #define REGISTER_CORE(core) \
454 - static void __attribute__((constructor)) register_core(void) \
454 + static void register_core(void) \
455 { \
456 static XtensaConfigList node = { \
457 .config = &core, \
458 }; \
459 xtensa_register_core(&node); \
460 - }
460 + } \
461 + type_init(register_core)
462 #else
463 #define REGISTER_CORE(core)
464 #endif