[PATCH 2/3] kbuild: force compiler to assume two's complement

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Oct 15 05:00:55 EDT 2020


The kernel is compiled with this option and kernel code we port assumes
that integer types are two's complement, so play it safe and disable
optimizations that are possibly buggy in respect to barebox.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 164f23e872df..ae713b5a665b 100644
--- a/Makefile
+++ b/Makefile
@@ -619,6 +619,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, trampolines)
 
 KBUILD_CFLAGS += $(call cc-option, -fno-delete-null-pointer-checks,)
 
+# disable invalid "can't wrap" optimizations for signed / pointers
+KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
+
 KBUILD_CFLAGS   += $(call cc-disable-warning, address-of-packed-member)
 
 # Align the bit size of userspace programs with the kernel
-- 
2.28.0




More information about the barebox mailing list