aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2022-12-13 05:46:07 +0100
committerStefano Babic <sbabic@denx.de>2023-01-30 23:23:02 +0100
commit3f7afddc9cbdcbbc47a0b814a132b76593cf8b28 (patch)
treef41626caa46212922183981a395f3b8825130f93 /arch
parent4408cd6641175b6f7a10d4456d51495426ae4cd9 (diff)
downloadu-boot-3f7afddc9cbdcbbc47a0b814a132b76593cf8b28.zip
u-boot-3f7afddc9cbdcbbc47a0b814a132b76593cf8b28.tar.gz
u-boot-3f7afddc9cbdcbbc47a0b814a132b76593cf8b28.tar.bz2
ARM: imx: bootaux: Fix LTO -Wlto-type-mismatch
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> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/mach-imx/sys_proto.h2
-rw-r--r--arch/arm/mach-imx/imx8m/soc.c5
-rw-r--r--arch/arm/mach-imx/imx_bootaux.c7
-rw-r--r--arch/arm/mach-imx/mx7/soc.c5
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 dd0d3f2..27fdc16 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 8050406..90a59bd 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 433c1f8..888c53d 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 02af0d5..689dbef 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)