diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0012-Revert-Makefile-enable-Werror-option.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0012-Revert-Makefile-enable-Werror-option.patch new file mode 100644 index 0000000000..e0d40ea793 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0012-Revert-Makefile-enable-Werror-option.patch @@ -0,0 +1,23 @@ +From 45be7edd81e458ca90985a0c687e769aa9ebaf5b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 9 Sep 2019 05:59:12 +0000 +Subject: [PATCH] Revert "Makefile: enable -Werror option" + +This reverts commit 76ba1d8a713bc964fc8e0a639f90344c4c60f026. +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index f81ac1f9f9..fe2a57fa58 100644 +--- a/Makefile ++++ b/Makefile +@@ -360,7 +360,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ + KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ + -Wno-format-security \ + -fno-builtin -ffreestanding +-KBUILD_CFLAGS += -fshort-wchar -Werror ++KBUILD_CFLAGS += -fshort-wchar + KBUILD_AFLAGS := -D__ASSEMBLY__ + + # Read UBOOTRELEASE from include/config/uboot.release (if it exists) diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0013-Makefile-adopt-std-gnu11-for-HOSTCFLAGS-on-Linux.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0013-Makefile-adopt-std-gnu11-for-HOSTCFLAGS-on-Linux.patch new file mode 100644 index 0000000000..3adb58eacb --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0013-Makefile-adopt-std-gnu11-for-HOSTCFLAGS-on-Linux.patch @@ -0,0 +1,48 @@ +From 4270dca0656b872ac44dc860151bba76c257cfe2 Mon Sep 17 00:00:00 2001 +From: Philipp Tomsich +Date: Mon, 14 May 2018 15:22:06 +0200 +Subject: [PATCH] Makefile: adopt --std=gnu11 for HOSTCFLAGS on Linux + +Following the conversion of the SPDX license tags, a number of files +compiled with -pedantic now generate warnings similar to the following +for using C99-style '//' comments in ISO C90 code: + + tools/gen_eth_addr.c:1:1: warning: C++ style comments are not allowed in ISO C90 + // SPDX-License-Identifier: GPL-2.0+ + ^ + +The SPDX comment-style change means that these files have adopted C99, +so need to change the language-standard to --std=gnu99 or --std=gnu11 +to let the compiler know this. + +As we now require GCC 6 or newer for the cross-compiler, the project has +implicitly moved the project to GNU11: let older GCC versions on various +Linux distros know to treat our host tools as GNU11 as well. + +References: commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style") +Signed-off-by: Philipp Tomsich +Reviewed-by: Tom Rini +--- + Makefile | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/Makefile b/Makefile +index fe2a57fa58..484a1eb01d 100644 +--- a/Makefile ++++ b/Makefile +@@ -260,6 +260,15 @@ HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ + $(if $(CONFIG_TOOLS_DEBUG),-g) + HOSTCXXFLAGS = -O2 + ++# With the move to GCC 6, we have implicitly upgraded our language ++# standard to GNU11 (see https://gcc.gnu.org/gcc-5/porting_to.html). ++# Some Linux distributions (including RHEL7, SLES13, Debian 8) still ++# have older compilers as their default, so we make it explicit for ++# these that our host tools are GNU11 (i.e. C11 w/ GNU extensions). ++ifeq ($(HOSTOS),linux) ++HOSTCFLAGS += --std=gnu11 ++endif ++ + ifeq ($(HOSTOS),cygwin) + HOSTCFLAGS += -ansi + endif diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0014-Makefile-Ensure-we-build-with-std-gnu11.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0014-Makefile-Ensure-we-build-with-std-gnu11.patch new file mode 100644 index 0000000000..54f082bb62 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0014-Makefile-Ensure-we-build-with-std-gnu11.patch @@ -0,0 +1,41 @@ +From 7fcf14b5dafa574cb9f565afebc8428c50f0be02 Mon Sep 17 00:00:00 2001 +From: Tom Rini +Date: Tue, 19 Jun 2018 23:53:54 -0400 +Subject: [PATCH] Makefile: Ensure we build with -std=gnu11 + +As many targets are now commonly built with gcc-6 or later (which +defaults to a newer C standard than older compilers), certain C +constructs are now being used as they produce more readable code. And +while all compilers that we support building with support the C11 +standard (and GNU11) they do not default to that standard. Ensure that +we pass along -std=gnu11 when building. + +Signed-off-by: Tom Rini +--- + Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 484a1eb01d..752bff499e 100644 +--- a/Makefile ++++ b/Makefile +@@ -265,8 +265,9 @@ HOSTCXXFLAGS = -O2 + # Some Linux distributions (including RHEL7, SLES13, Debian 8) still + # have older compilers as their default, so we make it explicit for + # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions). ++CSTD_FLAG := -std=gnu11 + ifeq ($(HOSTOS),linux) +-HOSTCFLAGS += --std=gnu11 ++HOSTCFLAGS += $(CSTD_FLAG) + endif + + ifeq ($(HOSTOS),cygwin) +@@ -368,7 +369,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ + + KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ + -Wno-format-security \ +- -fno-builtin -ffreestanding ++ -fno-builtin -ffreestanding $(CSTD_FLAG) + KBUILD_CFLAGS += -fshort-wchar + KBUILD_AFLAGS := -D__ASSEMBLY__ + diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0015-Makefile-Use-fno-strict-aliasing-globally.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0015-Makefile-Use-fno-strict-aliasing-globally.patch new file mode 100644 index 0000000000..e4b8243db1 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0015-Makefile-Use-fno-strict-aliasing-globally.patch @@ -0,0 +1,45 @@ +From dcee38742d6376e3fec6e5997077c681d28d1656 Mon Sep 17 00:00:00 2001 +From: Bin Meng +Date: Sun, 16 Sep 2018 22:35:28 -0700 +Subject: [PATCH] Makefile: Use -fno-strict-aliasing globally + +The -fstrict-aliasing option is implicitly enabled at levels -O2, +-O3, -Os by GCC. This option allows the compiler to assume the +strictest aliasing rules applicable to the language being compiled. +For example, the practice of reading from a different union member +than the one most recently written to (called "type-punning") is +common. In this case, "type-punning" only works if the memory is +accessed through the union type, but might not work by taking the +address, casting the resulting pointer and dereferencing the result, +which is an undefined behavior per the "strict aliasing rules". + +GCC's -Wstrict-aliasing (included in -Wall) option does not catch +all cases, but does attempt to catch the more common pitfalls. So +there are cases that GCC does not report but the codes are violating +the "strict aliasing rules". + +Given lots of codes that may be written to rely on "type-punning", +and Linux kernel disables it by -fno-strict-aliasing globally, since +U-Boot currently does this on nds32/riscv/x86 builds only, extend +this for all architecture builds. + +Signed-off-by: Bin Meng +Reviewed-by: Tom Rini +Reviewed-by: Simon Glass +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 752bff499e..14cf1fae33 100644 +--- a/Makefile ++++ b/Makefile +@@ -370,7 +370,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ + KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ + -Wno-format-security \ + -fno-builtin -ffreestanding $(CSTD_FLAG) +-KBUILD_CFLAGS += -fshort-wchar ++KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing + KBUILD_AFLAGS := -D__ASSEMBLY__ + + # Read UBOOTRELEASE from include/config/uboot.release (if it exists)