[PATCH u-boot v2 10/38] efi_loader: fix warning when linking with LTO

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Mar 12 17:42:35 CET 2021


On 12.03.21 11:34, Marek Behún wrote:
> When linking with LTO, the compiler complains about type mismatch of
> variables `__efi_runtime_start`, `__efi_runtime_stop`,
> `__efi_runtime_rel_start` and `__efi_runtime_rel_stop`:
>
>  include/efi_loader.h:218:21: warning: type of ‘__efi_runtime_start’
>                                        does not match original
>                                        declaration [-Wlto-type-mismatch]
>     218 | extern unsigned int __efi_runtime_start, __efi_runtime_stop;
>         |                     ^
>   arch/sandbox/lib/sections.c:7:6: note: ‘__efi_runtime_start’ was
>                                          previously declared here
>       7 | char __efi_runtime_start[0] __attribute__((section(".__efi_run
>         |      ^
>
> Change the type to char[] in include/efi_loader.h.
>
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

This patch leaves us with definition differences:

We have:

arch/arm/lib/sections.c:31:
char __efi_runtime_start[0]
__attribute__((section(".__efi_runtime_start")));

arch/x86/lib/sections.c:6:char __efi_runtime_start[0]
__attribute__((section(".__efi_runtime_start")));

We should use [] everywhere. [0] was needed by elder GCC versions.

Best regards

Heinrich

> ---
>  include/efi_loader.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index e38b41952d..a8281b3c95 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -215,8 +215,8 @@ extern const efi_guid_t efi_guid_capsule_report;
>  /* GUID of firmware management protocol */
>  extern const efi_guid_t efi_guid_firmware_management_protocol;
>
> -extern unsigned int __efi_runtime_start, __efi_runtime_stop;
> -extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
> +extern char __efi_runtime_start[], __efi_runtime_stop[];
> +extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[];
>
>  /**
>   * struct efi_open_protocol_info_item - open protocol info item
>



More information about the U-Boot mailing list