[coreboot] Makefiles question: -fno-delete-null-pointer-checks needed in Makefiles

Jens Rottmann JRottmann at LiPPERTembedded.de
Wed Mar 6 17:29:20 CET 2013


Hi Martin (and all),

I wrote:
>> You dereference dev in line 132, so if it's really 0,
>> will you then ever reach this check?? (I don't know if
>> in romstage *NULL is caught.)

You wrote:
> yes, if it's 0, we still reach the code. I've changed it
> to not dereference it before checking it though.

Per default, after any *ptr, GCC assumes a SEGFAULT would occur if ptr was ==0, so if control flow does reach the following code ptr must be !=0. ==> After any *ptr GCC will optimize away all ptr==0 or !=0 checks.  I know that because I recently hunted a related bug for a week (U-Boot, ARM, different project) until I looked at the actual assembly code.

Are you sure romstage (or maybe even ramstage?) will *NULL without segfaulting and just continue? And is romstage compiled with GCC (+ CAR) or is romcc used?

In that case "-fno-delete-null-pointer-checks" must be added to the GCC options.
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

I greped a bit, looks like it's not in any Makefiles yet.

Could someone who knows Coreboot's make/build system better than me maybe help, please?

Thanks
Jens



More information about the coreboot mailing list