9
0
Fork 0

Build with -fno-delete-null-pointer-checks

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>
This commit is contained in:
Sascha Hauer 2015-07-08 12:50:25 +02:00
parent d46b6785c4
commit d0c482359f
1 changed files with 2 additions and 1 deletions

View File

@ -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
AFLAGS := -D__ASSEMBLY__
LDFLAGS_barebox := -Map barebox.map