summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-08-31 18:41:44 +0800
committerGitHub <[email protected]>2018-08-31 18:41:44 +0800
commit07ec7e686d7e17886420d3085bf561e5185e6a6d (patch)
tree966146eb3a3585b10df5cbae00d9e9fe824d2488
parentd74d5801c8c08d57aa30732f6e52c082b3d215c5 (diff)
parent7c0c1c1b4ab91fae6ee4b138dface0e76e92bd95 (diff)
Merge pull request #1754 from liangyongxiang/rt-used
add RT_USED to component init and finsh shell
-rw-r--r--components/finsh/finsh_api.h58
-rw-r--r--include/rtdef.h10
2 files changed, 34 insertions, 34 deletions
diff --git a/components/finsh/finsh_api.h b/components/finsh/finsh_api.h
index 6bbe410b0b..3b7c77de2a 100644
--- a/components/finsh/finsh_api.h
+++ b/components/finsh/finsh_api.h
@@ -102,20 +102,20 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name);
};
#else
- #define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
- const char __fsym_##cmd##_name[] SECTION(".rodata.name") = #cmd; \
- const char __fsym_##cmd##_desc[] SECTION(".rodata.name") = #desc; \
- const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
+ #define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
+ const char __fsym_##cmd##_name[] SECTION(".rodata.name") = #cmd; \
+ const char __fsym_##cmd##_desc[] SECTION(".rodata.name") = #desc; \
+ RT_USED const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
- #define FINSH_VAR_EXPORT(name, type, desc) \
- const char __vsym_##name##_name[] SECTION(".rodata.name") = #name; \
- const char __vsym_##name##_desc[] SECTION(".rodata.name") = #desc; \
- const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
+ #define FINSH_VAR_EXPORT(name, type, desc) \
+ const char __vsym_##name##_name[] SECTION(".rodata.name") = #name; \
+ const char __vsym_##name##_desc[] SECTION(".rodata.name") = #desc; \
+ RT_USED const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
@@ -139,10 +139,10 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name);
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
__declspec(allocate("VSymTab")) const struct finsh_sysvar __vsym_##name = \
- { \
- __vsym_##name##_name, \
- type, \
- (void*)&name \
+ { \
+ __vsym_##name##_name, \
+ type, \
+ (void*)&name \
};
#elif defined(__TI_COMPILER_VERSION__)
@@ -159,28 +159,28 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name);
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name = \
- { \
- __vsym_##name##_name, \
- type, \
- (void*)&name \
+ { \
+ __vsym_##name##_name, \
+ type, \
+ (void*)&name \
};
#else
- #define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
- const char __fsym_##cmd##_name[] = #cmd; \
- const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
- { \
- __fsym_##cmd##_name, \
- (syscall_func)&name \
+ #define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
+ const char __fsym_##cmd##_name[] = #cmd; \
+ RT_USED const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
+ { \
+ __fsym_##cmd##_name, \
+ (syscall_func)&name \
};
- #define FINSH_VAR_EXPORT(name, type, desc) \
- const char __vsym_##name##_name[] = #name; \
- const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
- { \
- __vsym_##name##_name, \
- type, \
- (void*)&name \
+ #define FINSH_VAR_EXPORT(name, type, desc) \
+ const char __vsym_##name##_name[] = #name; \
+ RT_USED const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
+ { \
+ __vsym_##name##_name, \
+ type, \
+ (void*)&name \
};
#endif
diff --git a/include/rtdef.h b/include/rtdef.h
index d18ced3a6f..c37f90be2d 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