Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12298
-gerrit
commit 5b1f9c02835d9b07d32ab509481ccde282a0c801 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..bda0897 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 __builtin_trap()s accesses to 0 + # 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