summaryrefslogtreecommitdiff
path: root/include/rtdef.h
diff options
context:
space:
mode:
authorbernard <[email protected]>2013-07-24 07:33:48 +0800
committerbernard <[email protected]>2013-07-24 07:33:48 +0800
commita124e7bd22445ce90fc39419268d1b27e74ffd45 (patch)
tree6e10260ee04b990bf021b93b87aa2f7e04f1bb12 /include/rtdef.h
parentb96b35613f2cdc8118f083a3e2795788915319d7 (diff)
add initialization debug code
Diffstat (limited to 'include/rtdef.h')
-rw-r--r--include/rtdef.h16
1 files changed, 14 insertions, 2 deletions
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)