diff options
| author | liang yongxiang <[email protected]> | 2018-08-31 14:41:13 +0800 |
|---|---|---|
| committer | liang yongxiang <[email protected]> | 2018-08-31 15:01:04 +0800 |
| commit | 0aa03dd7314d84a0547300b55259294cae1edfd2 (patch) | |
| tree | d1d4f3bcb46e1afa3b28a387ce73ee75de42f1c8 /include | |
| parent | f7d19319ab848ba569d9a8611e2c2694eb447f65 (diff) | |
[kernel] add RT_USED to INIT_EXPORT, so that the initialization function is not deleted when it is linked.
Diffstat (limited to 'include')
| -rw-r--r-- | include/rtdef.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/rtdef.h b/include/rtdef.h index f8d90ceadb..735d535c7e 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -189,13 +189,13 @@ typedef int (*init_fn_t)(void); 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) = \ + #define INIT_EXPORT(fn, level) \ + const char __rti_##fn##_name[] = #fn; \ + RT_USED 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 + #define INIT_EXPORT(fn, level) \ + RT_USED const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn #endif #endif #else |
