public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Philippe Schenker <dev@pschenker.ch>
To: u-boot@lists.denx.de
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
	Philippe Schenker <philippe.schenker@toradex.com>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Stefano Babic <sbabic@denx.de>
Subject: [PATCH 1/2] imx: bootaux: Fix build warning when LTO is enabled
Date: Wed,  4 Jan 2023 20:02:15 +0100	[thread overview]
Message-ID: <20230104190216.145187-1-dev@pschenker.ch> (raw)

From: Francesco Dolcini <francesco.dolcini@toradex.com>

Fix conflicting declaration of hostmap[] variable. When building with
CONFIG_LTO=y we get the following warning:

  KSLCC   keep-syms-lto.o
  LTO     u-boot
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:1590:24: note: array types have different bounds
 1590 | const struct rproc_att hostmap[] = {
      |                        ^
arch/arm/mach-imx/imx8m/soc.c:1590:24: note: ‘hostmap’ was previously declared here
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin

Just remove the __weak declaration and add an extern, in any case this
variable is supposed to be declared in the SOC file and there is no way
to have imx_bootaux build with this variable not declared.

In addition to that the weak variable definition is not correct,
get_host_mapping() will just reference non initialized data, if ever now
will have a build error instead of undefined behavior at runtime.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
---

 arch/arm/mach-imx/imx_bootaux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 8115bf40f1a9..6c00ef6007e7 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -21,7 +21,7 @@
 #define SRC_M4_REG_OFFSET		0
 #endif
 
-const __weak struct rproc_att hostmap[] = { };
+extern const struct rproc_att hostmap[];
 
 static const struct rproc_att *get_host_mapping(unsigned long auxcore)
 {
-- 
2.39.0


             reply	other threads:[~2023-01-04 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 19:02 Philippe Schenker [this message]
2023-01-04 19:02 ` [PATCH 2/2] configs: verdin-imx8mm: Add bootaux command Philippe Schenker
2023-01-31  9:49   ` sbabic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230104190216.145187-1-dev@pschenker.ch \
    --to=dev@pschenker.ch \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=philippe.schenker@toradex.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox