Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12298
-gerrit
commit bd1edbcc7cf3e3e075ecdb6f34e6b47cfe40d174 Author: Patrick Georgi pgeorgi@chromium.org Date: Tue Nov 3 15:30:02 2015 +0100
xcompile: Tell gcc that we need to access NULL pointers occassionally
gcc developers consider NULL pointers to be so bad that they add a trap instruction (ud2 on x86, something similar on ARM) when gcc encounters one.
We need them every now and then (eg. via/cx700 raminit), so tell the compiler not to treat us like a userspace program.
Change-Id: I1a062bfa55548ed0c2d11196633c6f63e83b807c Signed-off-by: Patrick Georgi pgeorgi@chromium.org --- util/xcompile/xcompile | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 76c3698..8718c67 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -161,6 +161,11 @@ detect_special_flags() { testcc "$GCC" "$CFLAGS_GCC -Wl,--build-id=none" && CFLAGS_GCC="$CFLAGS_GCC -Wl,--build-id=none"
+ # Without this flag, gcc's __builtin_trap() traps accesses to NULL + # that may well be intended in RAM init code. + testcc "$GCC" "$CFLAGS_GCC -fno-delete-null-pointer-checks"&& + CFLAGS_GCC="$CFLAGS_GCC -fno-delete-null-pointer-checks" + case "$architecture" in x86) # Always build for i686 -- no sse/mmx instructions since SMM