diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/rtdebug.h | 4 | ||||
| -rw-r--r-- | include/rtdef.h | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/include/rtdebug.h b/include/rtdebug.h index adcea8a8bf..ebf85d6dba 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -63,6 +63,10 @@ #define RT_DEBUG_IPC 0 #endif +#ifndef RT_DEBUG_INIT +#define RT_DEBUG_INIT 0 +#endif + /* Turn on this to enable context check */ #ifndef RT_DEBUG_CONTEXT_CHECK #define RT_DEBUG_CONTEXT_CHECK 1 diff --git a/include/rtdef.h b/include/rtdef.h index 1d64ae54f4..a3d13bfc44 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -181,8 +181,20 @@ typedef int (*init_fn_t)(void); #ifdef _MSC_VER /* we do not support MS VC++ compiler */ #define INIT_EXPORT(fn, level) #else - #define INIT_EXPORT(fn, level) \ - const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn + #if RT_DEBUG_INIT + struct rt_init_desc + { + const char* fn_name; + const init_fn_t fn; + }; + #define INIT_EXPORT(fn, level) \ + const char __rti_##fn##_name[] = #fn; \ + const struct rt_init_desc __rt_init_desc_##fn SECTION(".rti_fn."level) = \ + { __rti_##fn##_name, fn}; + #else + #define INIT_EXPORT(fn, level) \ + const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn + #endif #endif #else #define INIT_EXPORT(fn, level) |
