imx_bootaux lto issue

Tom Rini trini at konsulko.com
Wed Aug 31 16:38:32 CEST 2022


On Thu, Aug 18, 2022 at 04:19:52PM +0000, Marcel Ziswiler wrote:
> Hi there
> 
> If one enables both CONFIG_IMX_BOOTAUX and CONFIG_LTO (e.g. just adding the later to the verdin-
> imx8mp_defconfig) one gets the following build failure:
> 
> arch/arm/mach-imx/imx_bootaux.c:24:31: warning: type of ‘hostmap’ does not match original declaration [-Wlto-
> type-mismatch]
>    24 | const __weak struct rproc_att hostmap[] = { };
>       |                               ^
> arch/arm/mach-imx/imx8m/soc.c:1578:24: note: array types have different bounds
>  1578 | const struct rproc_att hostmap[] = {
>       |                        ^
> arch/arm/mach-imx/imx8m/soc.c:1578:24: note: ‘hostmap’ was previously declared here
> 
> This is with Arm's gcc 10.3-2021.07 (arm-10.29).
> 
> I tried the approach with adding pragmas around it e.g. as follows:
> 
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wlto-type-mismatch"
> const __weak struct rproc_att hostmap[] = { };
> #pragma GCC diagnostic pop
> 
> But that does not seem to improve the situation. Is anybody more familiar with this stuff and what exactly
> needs to be done to fix this?

So it looks like LTO and weak const structures don't get along? I would
file a gcc bug to see if it'll get fixed, or if we'll be told to stop
doing that as it's a bad idea. That said, maybe we should rework the
code in question? Is there a valid case to be building
arch/arm/mach-imx/imx_bootaux.c and not have a non-empty hostmap
defined?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220831/cf66c1e4/attachment.sig>


More information about the U-Boot mailing list