public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] armv8: add asserts of sizes to u-boot-spl.lds
Date: Mon, 26 Dec 2016 16:20:41 +0200	[thread overview]
Message-ID: <1482762041-8416-2-git-send-email-oded.gabbay@gmail.com> (raw)
In-Reply-To: <1482762041-8416-1-git-send-email-oded.gabbay@gmail.com>

This patch copies from arm u-boot-spl.lds some asserts that check that the
size of the SPL image and BSS doesn't violate their max size.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
---
 arch/arm/cpu/armv8/u-boot-spl.lds | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds
index e7799cc..0876a94 100644
--- a/arch/arm/cpu/armv8/u-boot-spl.lds
+++ b/arch/arm/cpu/armv8/u-boot-spl.lds
@@ -78,3 +78,22 @@ SECTIONS
 	/DISCARD/ : { *(.interp*) }
 	/DISCARD/ : { *(.gnu*) }
 }
+
+#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) && defined(CONFIG_SPL_MAX_FOOTPRINT)
+ASSERT(0, "CONFIG_SPL_BSS_MAX_SIZE and CONFIG_SPL_MAX_FOOTPRINT must not be defined together");
+#endif
+
+#if defined(CONFIG_SPL_BSS_MAX_SIZE)
+ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \
+	"SPL image BSS too big");
+#endif
+
+#if defined(CONFIG_SPL_MAX_FOOTPRINT)
+ASSERT(__bss_end - _start < (CONFIG_SPL_MAX_FOOTPRINT), \
+	"SPL image plus BSS too big");
+#endif
-- 
2.7.4

  reply	other threads:[~2016-12-26 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 14:20 [U-Boot] [PATCH 1/2] armv8: calculate __bss_size in u-boot-spl.lds Oded Gabbay
2016-12-26 14:20 ` Oded Gabbay [this message]
2017-01-09  0:56   ` [U-Boot] [PATCH 2/2] armv8: add asserts of sizes to u-boot-spl.lds Tom Rini
2017-01-17  7:55   ` Masahiro Yamada
2017-01-17  8:04     ` Oded Gabbay
2017-01-17  9:27 ` [U-Boot] [PATCH 1/2] armv8: calculate __bss_size in u-boot-spl.lds Oded Gabbay
2017-01-19 11:28   ` Masahiro Yamada
2017-01-26 14:24     ` Simon Glass

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=1482762041-8416-2-git-send-email-oded.gabbay@gmail.com \
    --to=oded.gabbay@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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