From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Michael Olbrich <mol@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] Build with -fno-delete-null-pointer-checks
Date: Mon, 13 Jul 2015 09:13:04 +0200 [thread overview]
Message-ID: <20150713071304.GG18700@pengutronix.de> (raw)
In-Reply-To: <559D4C69.8080001@pengutronix.de>
On Wed, Jul 08, 2015 at 06:14:33PM +0200, Marc Kleine-Budde wrote:
> On 07/08/2015 12:57 PM, Sascha Hauer wrote:
> > This becomes important with gcc-4.9. Without this gcc assumes
> > that accessing NULL pointers traps and everything that happens
> > behind the access is not executed. This recently happened with
> > i.MX53 which has:
> >
> > static int imx53_silicon_revision(void)
> > {
> > void __iomem *rom = MX53_IROM_BASE_ADDR;
> >
> > rev = readl(rom + SI_REV);
> > ...
> > }
> >
> > This resulted in object code in which the last instruction is
> > the readl, the reset of the function is missing because gcc assumes this
> > is never executed.
> >
> > Disable this optimization with -fno-delete-null-pointer-checks since
> > in barebox NULL pointers can indeed be valid.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > Makefile | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index e7db67a..0fe9274 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -301,7 +301,8 @@ CPPFLAGS := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builtin -ffre
> >
> > CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> > -Werror-implicit-function-declaration \
> > - -fno-strict-aliasing -fno-common -Os -pipe
> > + -fno-strict-aliasing -fno-common -Os -pipe \
> > + -fno-delete-null-pointer-checks
> The kernel uses:
> $(call cc-option,-fno-delete-null-pointer-checks,)
Changed it to do the same.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-07-13 7:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 10:57 [PATCH] Build with -fno-delete-null-pointer-checks Sascha Hauer
2015-07-08 16:14 ` Marc Kleine-Budde
2015-07-13 7:13 ` Sascha Hauer [this message]
2015-07-13 7:19 ` Uwe Kleine-König
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=20150713071304.GG18700@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mkl@pengutronix.de \
--cc=mol@pengutronix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.