diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/event.h | 35 | ||||
| -rw-r--r-- | include/linker_lists.h | 9 |
2 files changed, 5 insertions, 39 deletions
diff --git a/include/event.h b/include/event.h index 3ce5f992b04..450281f666a 100644 --- a/include/event.h +++ b/include/event.h @@ -308,44 +308,13 @@ static inline const char *event_spy_id(struct evspy_info *spy) #endif } -/* - * It seems that LTO will drop list entries if it decides they are not used, - * although the conditions that cause this are unclear. - * - * The example found is the following: - * - * static int sandbox_misc_init_f(void *ctx, struct event *event) - * { - * return sandbox_early_getopt_check(); - * } - * EVENT_SPY_FULL(EVT_MISC_INIT_F, sandbox_misc_init_f); - * - * where EVENT_SPY_FULL uses ll_entry_declare() - * - * In this case, LTO decides to drop the sandbox_misc_init_f() function - * (which is fine) but then drops the linker-list entry too. This means - * that the code no longer works, in this case sandbox no-longer checks its - * command-line arguments properly. - * - * Without LTO, the KEEP() command in the .lds file is enough to keep the - * entry around. But with LTO it seems that the entry has already been - * dropped before the link script is considered. - * - * The only solution I can think of is to mark linker-list entries as 'used' - * using an attribute. This should be safe, since we don't actually want to drop - * any of these. However this does slightly limit LTO's optimisation choices. - * - * Another issue has come up, only with clang: using 'static' makes it throw - * away the linker-list entry sometimes, e.g. with the EVT_FT_FIXUP entry in - * vbe_simple.c - so for now, make it global. - */ #define EVENT_SPY_FULL(_type, _func) \ - __used ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \ + ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \ evspy_info) = _ESPY_REC(_type, _func) /* Simple spy with no function arguments */ #define EVENT_SPY_SIMPLE(_type, _func) \ - __used ll_entry_declare(struct evspy_info_simple, \ + ll_entry_declare(struct evspy_info_simple, \ _type ## _3_ ## _func, \ evspy_info) = _ESPY_REC_SIMPLE(_type, _func) diff --git a/include/linker_lists.h b/include/linker_lists.h index 4425fcb6785..a8b7e2c9f2b 100644 --- a/include/linker_lists.h +++ b/include/linker_lists.h @@ -69,7 +69,6 @@ */ #define ll_entry_declare(_type, _name, _list) \ _type _u_boot_list_2_##_list##_2_##_name __aligned(4) \ - __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_2_"#_name) /** @@ -92,7 +91,6 @@ */ #define ll_entry_declare_list(_type, _name, _list) \ _type _u_boot_list_2_##_list##_2_##_name[] __aligned(4) \ - __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_2_"#_name) /* @@ -125,7 +123,6 @@ #define ll_entry_start(_type, _list) \ ({ \ static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ - __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_1"); \ _type * tmp = (_type *)&start; \ asm("":"+r"(tmp)); \ @@ -167,7 +164,7 @@ */ #define ll_entry_end(_type, _list) \ ({ \ - static char end[0] __aligned(1) __attribute__((unused)) \ + static char end[0] __aligned(1) \ __section("__u_boot_list_2_"#_list"_3"); \ _type * tmp = (_type *)&end; \ asm("":"+r"(tmp)); \ @@ -251,7 +248,7 @@ */ #define ll_start_decl(_sym, _type, _list) \ static _type _sym[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ - __maybe_unused __section("__u_boot_list_2_" #_list "_1") + __section("__u_boot_list_2_" #_list "_1") /* * ll_end_decl uses __aligned(1) to avoid padding before the end marker. @@ -259,7 +256,7 @@ */ #define ll_end_decl(_sym, _type, _list) \ static _type _sym[0] __aligned(1) \ - __maybe_unused __section("__u_boot_list_2_" #_list "_3") + __section("__u_boot_list_2_" #_list "_3") /** * ll_entry_get() - Retrieve entry from linker-generated array by name |
