From patchwork Mon Apr 8 19:58:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert ARIBAUD X-Patchwork-Id: 234878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DC0432C0095 for ; Tue, 9 Apr 2013 05:59:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DE3F4A700; Mon, 8 Apr 2013 21:59:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0zwL5Du-cZ90; Mon, 8 Apr 2013 21:59:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45EA94A6D9; Mon, 8 Apr 2013 21:59:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8F6B44A6D0 for ; Mon, 8 Apr 2013 21:59:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M2JQSPfWprbq for ; Mon, 8 Apr 2013 21:59:23 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by theia.denx.de (Postfix) with ESMTP id 188BD4A6A8 for ; Mon, 8 Apr 2013 21:59:16 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2a01:e35:2eb9:20:dc45:4f0c:63a7:b7f3]) (Authenticated sender: albert.aribaud) by smtp1-g21.free.fr (Postfix) with ESMTPSA id 2DC399401C6; Mon, 8 Apr 2013 21:59:10 +0200 (CEST) From: Albert ARIBAUD To: u-boot@lists.denx.de Date: Mon, 8 Apr 2013 21:58:29 +0200 Message-Id: <1365451109-22030-5-git-send-email-albert.u.boot@aribaud.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1365451109-22030-4-git-send-email-albert.u.boot@aribaud.net> References: <1365451109-22030-1-git-send-email-albert.u.boot@aribaud.net> <1365451109-22030-2-git-send-email-albert.u.boot@aribaud.net> <1365451109-22030-3-git-send-email-albert.u.boot@aribaud.net> <1365451109-22030-4-git-send-email-albert.u.boot@aribaud.net> Subject: [U-Boot] [PATCH 4/4] ARM: fix CONFIG_SPL_MAX_SIZE semantics X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The ASSERT() in arch/arm/cpu/u-boot.lds is unneeded as this linker file is not used for SPL builds. Remove it. The ASSERT() in arch/arm/cpu/u-boot-spl.lds is wrong as it compares image+BSS size to max image size only. Split it in two distinct ASSERT()s, one for image size, one for BSS size. Finally, update README regarding the (now homogeneous) semantics of the CONFIG_SPL_MAX_SIZE and CONFIG_SPL_BSS_MAX_SIZE macros. Signed-off-by: Albert ARIBAUD --- README | 17 +++++++++++++++-- arch/arm/cpu/u-boot-spl.lds | 10 ++++++++-- arch/arm/cpu/u-boot.lds | 4 ---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README b/README index a35ef31..c902421 100644 --- a/README +++ b/README @@ -2784,7 +2784,14 @@ FIT uImage format: LDSCRIPT for linking the SPL binary. CONFIG_SPL_MAX_SIZE - Maximum binary size (text, data and rodata) of the SPL binary. + Maximum size for the image (sum of the text, data, rodata + and linker lists sections) of the SPL executable. + When defined, linker checks that the actual image size does + not exceed it. + The total amount of memory used by the SPL when running is + equal CONFIG_SPL_MAX_SIZE, plus CONFIG_SPL_BSS_MAX_SIZE if + it exists. + Note: image and BSS are disjoint for some targets. CONFIG_SPL_TEXT_BASE TEXT_BASE for linking the SPL binary. @@ -2797,7 +2804,13 @@ FIT uImage format: Link address for the BSS within the SPL binary. CONFIG_SPL_BSS_MAX_SIZE - Maximum binary size of the BSS section of the SPL binary. + Maximum size of the BSS section of the SPL executable. + When defined, linker checks that the actual BSS size does + not exceed it. + The total amount of memory used by the SPL when running is + equal CONFIG_SPL_MAX_SIZE, plus CONFIG_SPL_BSS_MAX_SIZE if + it exists. + Note: image and BSS are disjoint for some targets. CONFIG_SPL_STACK Adress of the start of the stack SPL will use diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds index 3c0d99c..89ef9ce 100644 --- a/arch/arm/cpu/u-boot-spl.lds +++ b/arch/arm/cpu/u-boot-spl.lds @@ -88,6 +88,12 @@ SECTIONS /DISCARD/ : { *(.gnu*) } } -#if defined(CONFIG_SPL_TEXT_BASE) && defined(CONFIG_SPL_MAX_SIZE) -ASSERT(__bss_end < (CONFIG_SPL_TEXT_BASE + CONFIG_SPL_MAX_SIZE), "SPL image too big"); +#if defined(CONFIG_SPL_MAX_SIZE) +ASSERT(__image_copy_end - __image_copy_start < (CONFIG_SPL_MAX_SIZE), \ + "SPL image too big"); +#endif + +#if defined(CONFIG_SPL_BSS_MAX_SIZE) +ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS MAX_SIZE), \ + "SPL image BSS too big"); #endif diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 3a1083d..7bbc4f5 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -101,7 +101,3 @@ SECTIONS /DISCARD/ : { *(.interp*) } /DISCARD/ : { *(.gnu*) } } - -#if defined(CONFIG_SPL_TEXT_BASE) && defined(CONFIG_SPL_MAX_SIZE) -ASSERT(__bss_end < (CONFIG_SPL_TEXT_BASE + CONFIG_SPL_MAX_SIZE), "SPL image too big"); -#endif