Skip to contentSkip to conversation

powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

PATCH New Prabhakar Kushwaha 5 participants 7 messages May 7, 2015 – Jul 1, 2015 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.

gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. Add -fno-delete-null-pointer-checks to disable the optimization

---
 arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/config.mk +2 -1
index 72c964c..2aedd24 100644
@@ -5,7 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
+					-fno-delete-null-pointer-checks
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
 # see "[PATCH,rs6000] make -mno-spe work as expected" on
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

Scott,

Please comment on this patch.

York

Quoted 30 lines · Prabhakar Kushwaha

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.

gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. Add -fno-delete-null-pointer-checks to disable the optimization

---
 arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/config.mk +2 -1
index 72c964c..2aedd24 100644
@@ -5,7 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
+					-fno-delete-null-pointer-checks
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
 # see "[PATCH,rs6000] make -mno-spe work as expected" on
#2 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

Quoted 5 lines · York Sun

Scott,

Please comment on this patch.

York

I think this should be set treewide (as Linux does), not just for mpc85xx. But use cc-option to make sure that the compiler supports the option.

-Scott

Quoted 32 lines · Prabhakar Kushwaha
Quoted 30 lines

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.

gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. Add -fno-delete-null-pointer-checks to disable the optimization

---
 arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/config.mk +2 -1
index 72c964c..2aedd24 100644
@@ -5,7 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
+					-fno-delete-null-pointer-checks
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
 # see "[PATCH,rs6000] make -mno-spe work as expected" on
#3 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

Hi Simon, Tom,

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.
gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 release notes:
https://gcc.gnu.org/gcc-4.9/porting_to.html

There is possibility after moving to gcc-4.9 some platform may/may not work properly.
I tested this patch for freescale powerpc platforms.
But It may needs be taken care by all architecture like ARM, powerpc. If this is the case; this flag should be in top level Makefile (not sure)

Regards,
Prabhakar

Quoted 56 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, May 20, 2015 11:04 PM
To: Sun York-R58495
Cc: Kushwaha Prabhakar-B32579; u-boot at lists.denx.de; Dharmakan Rohit- B30502
Subject: Re: [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null- pointer-checks

Quoted 5 lines · York Sun

Scott,

Please comment on this patch.

York

I think this should be set treewide (as Linux does), not just for mpc85xx. But use cc-option to make sure that the compiler supports the option.

-Scott

Quoted 5 lines · Prabhakar Kushwaha
Quoted 3 lines

-fdelete-null-pointer-checks flag controls global dataflow analyses
and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be

null.

Quoted 28 lines
Quoted 28 lines

This flag is enabled by default.

gcc v4.9 has more optimizations added to this option. Hence it is
very aggressive with GCC v4.9 series. Add -fno-delete-null-pointer-checks to disable the optimization

---
 arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/config.mk +2 -1
index 72c964c..2aedd24 100644
@@ -5,7 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
+					-fno-delete-null-pointer-checks
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;  #

see "[PATCH,rs6000] make -mno-spe work as expected" on

#4 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

Hi,

Quoted 10 lines · Kushwaha Prabhakar

Hi Simon, Tom,

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.
gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 release notes:
https://gcc.gnu.org/gcc-4.9/porting_to.html

There is possibility after moving to gcc-4.9 some platform may/may not work properly.
I tested this patch for freescale powerpc platforms.
But It may needs be taken care by all architecture like ARM, powerpc. If this is the case; this flag should be in top level Makefile (not sure)

I suspect a top-level option would be best, perhaps near this one in Makefile:

KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)

Regards,
Simon

Quoted 60 lines

Regards,
Prabhakar

Quoted 56 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, May 20, 2015 11:04 PM
To: Sun York-R58495
Cc: Kushwaha Prabhakar-B32579; u-boot at lists.denx.de; Dharmakan Rohit- B30502
Subject: Re: [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null- pointer-checks

Quoted 5 lines · York Sun

Scott,

Please comment on this patch.

York

I think this should be set treewide (as Linux does), not just for mpc85xx. But use cc-option to make sure that the compiler supports the option.

-Scott

Quoted 5 lines · Prabhakar Kushwaha
Quoted 3 lines

-fdelete-null-pointer-checks flag controls global dataflow analyses
and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be

null.

Quoted 28 lines
Quoted 28 lines

This flag is enabled by default.

gcc v4.9 has more optimizations added to this option. Hence it is
very aggressive with GCC v4.9 series. Add -fno-delete-null-pointer-checks to disable the optimization

---
 arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/config.mk +2 -1
index 72c964c..2aedd24 100644
@@ -5,7 +5,8 @@
 # SPDX-License-Identifier:       GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
+                                 -fno-delete-null-pointer-checks
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;  #

see "[PATCH,rs6000] make -mno-spe work as expected" on

#5 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

Quoted 9 lines · Simon Glass

Hi,

Quoted 6 lines · Kushwaha Prabhakar

Hi Simon, Tom,

-fdelete-null-pointer-checks flag controls global dataflow analyses and eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.
gcc v4.9 has more optimizations added to this option. Hence it is very aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 release notes:
https://gcc.gnu.org/gcc-4.9/porting_to.html

Quoted 8 lines
Quoted 4 lines

There is possibility after moving to gcc-4.9 some platform may/may not work properly.
I tested this patch for freescale powerpc platforms.
But It may needs be taken care by all architecture like ARM, powerpc. If this is the case; this flag should be in top level Makefile (not sure)

I suspect a top-level option would be best, perhaps near this one in Makefile:

KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)

I also agree with Scott and Simon, default, top level, using cc-option just like the Linux kernel please, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150630/02bb2b87/attachment.sig>
#6 lore raw

PATCH 1/1 powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

In reply to Simon Glass
Quoted 33 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Tuesday, June 30, 2015 8:28 PM
To: Kushwaha Prabhakar-B32579
Cc: Wood Scott-B07421; Sun York-R58495; trini at konsulko.com; u- boot at lists.denx.de; Dharmakan Rohit-B30502
Subject: Re: [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null- pointer-checks

Hi,

Quoted 3 lines · Kushwaha Prabhakar

Hi Simon, Tom,

-fdelete-null-pointer-checks flag controls global dataflow analyses and

eliminate useless checks for null pointers; It assume that if a pointer is checked after it has already been dereferenced, it cannot be null. This flag is enabled by default.

Quoted 1 line

gcc v4.9 has more optimizations added to this option. Hence it is very

aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 release notes:

Quoted 3 lines

https://gcc.gnu.org/gcc-4.9/porting_to.html

There is possibility after moving to gcc-4.9 some platform may/may not

work properly.

Quoted 5 lines

I tested this patch for freescale powerpc platforms.
But It may needs be taken care by all architecture like ARM, powerpc. If this is the case; this flag should be in top level Makefile (not sure)

Quoted 4 lines

I suspect a top-level option would be best, perhaps near this one in Makefile:

KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)

I agree to put it here.

But how to test it against different platform supported by u-boot.

--prabhakar