Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 425A7C4332F for ; Tue, 13 Dec 2022 04:46:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 94B5D8545D; Tue, 13 Dec 2022 05:46:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1670906782; bh=/xvuehw+UcSRPCJPLRwFXsogZ2wwpewzuplXPsogUpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=F8sjZupiEuFMd98PYjKRR1I8R4r02dpcLYYSORTalI/ZB3RpPhLpbRJdBbuW2rR/K KlH2OMMvDAugSjAufnsn2BlKZWjkx0KalpSci57LfkbN86WdiKrrx/BZgAeLqNubjs 8MMFMmucdH/2uzNxRf4Ja/TacDx0jjWYK0gSVNSckTgmcapZpHgEW2Cy6CRuq39vEM zO88WHVJ8WPbytl4co9WUEUtNrGHq0apKHotteUVisUrtpPFJTJCbFZIcn2MWhBM/v 5nr9wdKGRenv95g9XhLpmVXrk13vN66ctNCrEg5wgQV5bUP9b8g9pyJUSP2YzEb4gg WgkyOZq7hoNmQ== Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 8883D85207; Tue, 13 Dec 2022 05:46:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1670906778; bh=/xvuehw+UcSRPCJPLRwFXsogZ2wwpewzuplXPsogUpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRX9pw92PjvoXQ+1jMj2moKWgRHg+qvcfX/G0iSyseNJCQZHmxvmuOx6NuayyP/II rmeDbepaguEeqtCbyO+SOBWlrcap75wF2QL2O+fJb5gg+LJ4ce3kGkEW+VoE0FKsNU lCooNk+gTbe4tni93+A0zD5fy/FAGuSp7KcECs+qptv9de8FpMAqCo/93lz/jdoCbD A5dOsU7XaPiJLvd39mWyYyiP2Ffopl73y1d77AV0vttaoPrYwKUADjDbXIyZVrnFci 33yrfHWlDOSaZlBsgLyYUmqTcHbkYHlbtRgZZF1mFIlYSvGylcV9NXG3wvS6eYRJL3 NlIh869FA3vzw== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , "NXP i.MX U-Boot Team" , Fabio Estevam , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Peng Fan , Stefano Babic Subject: [PATCH 2/2] ARM: imx: bootaux: Fix LTO -Wlto-type-mismatch Date: Tue, 13 Dec 2022 05:46:07 +0100 Message-Id: <20221213044607.268450-2-marex@denx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221213044607.268450-1-marex@denx.de> References: <20221213044607.268450-1-marex@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- Cc: "NXP i.MX U-Boot Team" Cc: Fabio Estevam Cc: Marek Behún Cc: Peng Fan Cc: Stefano Babic --- 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