[PATCH] linker_lists.h: Add attribute used to ll_entry_start macro

Simon Glass sjg at google.com
Wed Feb 22 20:16:52 CET 2023


On Tue, 21 Feb 2023 at 16:27, Aditya Kumar <appujee at google.com> wrote:
>
> From 2d7c1398d048f11e92945c88a17a907efe8db553 Mon Sep 17 00:00:00 2001
> From: AdityaK <appujee at google.com>
> Date: Tue, 21 Feb 2023 15:05:54 -0800
> Subject: [PATCH] Add attribute used to macro
>
> The variable gets dropped by clang compiler in an optimized builds.
> Adding attribute((used)) allows the symbol to be preserved. Similar
> changes have been proposed in the past e.g.,
> 569524741a01e1a96fc2b75dd7e5d12e41ce6c2b for ll_entry_declare macro.
>
> ---
>  include/linker_lists.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


>
> diff --git a/include/linker_lists.h b/include/linker_lists.h
> index d3da9d44e8..4cd13c3bc8 100644
> --- a/include/linker_lists.h
> +++ b/include/linker_lists.h
> @@ -125,7 +125,7 @@
>  #define ll_entry_start(_type, _list) \
>  ({ \
>   static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \
> - __attribute__((unused)) \
> + __attribute__((unused)) __attribute__((used)) \
>   __section("__u_boot_list_2_"#_list"_1"); \
>   (_type *)&start; \
>  })
> --
> 2.39.2.637.g21b0678d19-goog


More information about the U-Boot mailing list