From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: "Marek Vasut" <marex@denx.de>,
"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Marek Behún" <kabel@kernel.org>, "Peng Fan" <peng.fan@nxp.com>,
"Stefano Babic" <sbabic@denx.de>
Subject: [PATCH 2/2] ARM: imx: bootaux: Fix LTO -Wlto-type-mismatch
Date: Tue, 13 Dec 2022 05:46:07 +0100 [thread overview]
Message-ID: <20221213044607.268450-2-marex@denx.de> (raw)
In-Reply-To: <20221213044607.268450-1-marex@denx.de>
Commit 56c2dbdabab5 ("imx: bootaux: cleanup code") introduces the
following LTO related warning:
"
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
../aarch64-linux-gnu/bin/ld: warning: u-boot has a LOAD segment with RWX permissions
"
This is because the weak empty array of structures "hostmap" is eventually
replaced by non-empty array of structures with different number of elements.
Fix this by avoiding weak variable size array, instead use a weak function
which returns single pointer to the array.
Fixes: 56c2dbdabab5 ("imx: bootaux: cleanup code")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Marek Behún <kabel@kernel.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---
arch/arm/include/asm/mach-imx/sys_proto.h | 2 ++
arch/arm/mach-imx/imx8m/soc.c | 5 +++++
arch/arm/mach-imx/imx_bootaux.c | 7 +++++--
arch/arm/mach-imx/mx7/soc.c | 5 +++++
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
index dd0d3f29333..27fdc16cd50 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -149,6 +149,8 @@ struct rproc_att {
u32 size; /* size of reg range */
};
+const struct rproc_att *imx_bootaux_get_hostmap(void);
+
struct rom_api {
u16 ver;
u16 tag;
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index a4863281e36..5e92f8143cf 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1610,4 +1610,9 @@ const struct rproc_att hostmap[] = {
{ 0x40000000, 0x40000000, 0x80000000 },
{ /* sentinel */ }
};
+
+const struct rproc_att *imx_bootaux_get_hostmap(void)
+{
+ return hostmap;
+}
#endif
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 433c1f80cee..888c53d6901 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -21,11 +21,14 @@
#define SRC_M4_REG_OFFSET 0
#endif
-const __weak struct rproc_att hostmap[] = { };
+__weak const struct rproc_att *imx_bootaux_get_hostmap(void)
+{
+ return NULL;
+}
static const struct rproc_att *get_host_mapping(unsigned long auxcore)
{
- const struct rproc_att *mmap = hostmap;
+ const struct rproc_att *mmap = imx_bootaux_get_hostmap();
while (mmap && mmap->size) {
if (mmap->da <= auxcore &&
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 02af0d568f2..689dbefe8ee 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -224,6 +224,11 @@ const struct rproc_att hostmap[] = {
{ 0x80000000, 0x80000000, 0x60000000 }, /* DDRC */
{ /* sentinel */ }
};
+
+const struct rproc_att *imx_bootaux_get_hostmap(void)
+{
+ return hostmap;
+}
#endif
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
--
2.35.1
next prev parent reply other threads:[~2022-12-13 4:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 4:46 [PATCH 1/2] ARM: imx: bootaux: Fix macro misuse Marek Vasut
2022-12-13 4:46 ` Marek Vasut [this message]
2022-12-13 7:41 ` [PATCH 2/2] ARM: imx: bootaux: Fix LTO -Wlto-type-mismatch Peng Fan
2023-01-31 9:51 ` sbabic
2022-12-13 7:41 ` [PATCH 1/2] ARM: imx: bootaux: Fix macro misuse Peng Fan
2023-01-31 9:51 ` 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=20221213044607.268450-2-marex@denx.de \
--to=marex@denx.de \
--cc=festevam@gmail.com \
--cc=kabel@kernel.org \
--cc=peng.fan@nxp.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