aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-05-15 15:26:54 -0400
committerTom Rini <trini@konsulko.com>2023-05-15 15:26:54 -0400
commit5d0b3dde115b0d26d414199678983d01b738ad1b (patch)
tree2d08c0a256f50eb3c22bfbb84b2fc9cc3eb0e980
parenteaa9efafffaf87e3414db5d21face5e2dad105e4 (diff)
parent6ab7c3d6bab1584e43f0c0a7e92134811b78bc61 (diff)
downloadu-boot-5d0b3dde115b0d26d414199678983d01b738ad1b.zip
u-boot-5d0b3dde115b0d26d414199678983d01b738ad1b.tar.gz
u-boot-5d0b3dde115b0d26d414199678983d01b738ad1b.tar.bz2
Merge branch '2023-05-15-build-system-updates' into next
- Bring in a few kbuild changes from upstream Linux to fix running the checker (make C=1/C=2), and clean up some of the logic related to how choose what device trees to build.
-rw-r--r--Makefile6
-rw-r--r--include/linux/build_bug.h40
-rw-r--r--include/linux/stddef.h8
-rw-r--r--scripts/Makefile.dts2
-rw-r--r--scripts/Makefile.lib7
-rwxr-xr-xscripts/dtc-version.sh2
6 files changed, 21 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index fb02bba..3f5249c 100644
--- a/Makefile
+++ b/Makefile
@@ -423,7 +423,8 @@ DTC_MIN_VERSION := 010406
CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
- -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
+ -Wbitwise -Wno-return-void -Wno-unknown-attribute \
+ -D__CHECK_ENDIAN__ $(CF)
KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
@@ -1032,6 +1033,9 @@ ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
LDFLAGS_u-boot += -Ttext $(CONFIG_TEXT_BASE)
endif
+# make the checker run with the right architecture
+CHECKFLAGS += --arch=$(ARCH)
+
# insure the checker run with the right endianness
CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index 9c7088b..20c2dc7 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -4,15 +4,16 @@
#include <linux/compiler.h>
#ifdef __CHECKER__
-#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
-#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
#define BUILD_BUG_ON_ZERO(e) (0)
-#define BUILD_BUG_ON_NULL(e) ((void *)0)
-#define BUILD_BUG_ON_INVALID(e) (0)
-#define BUILD_BUG_ON_MSG(cond, msg) (0)
-#define BUILD_BUG_ON(condition) (0)
-#define BUILD_BUG() (0)
#else /* __CHECKER__ */
+/*
+ * Force a compilation error if condition is true, but also produce a
+ * result (of value 0 and type int), so the expression can be used
+ * e.g. in a structure initializer (or where-ever else comma expressions
+ * aren't permitted).
+ */
+#define BUILD_BUG_ON_ZERO(e) ((int)sizeof(struct { int:(-!!(e)); }))
+#endif /* __CHECKER__ */
/* Force a compilation error if a constant expression is not a power of 2 */
#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
@@ -21,15 +22,6 @@
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
/*
- * Force a compilation error if condition is true, but also produce a
- * result (of value 0 and type size_t), so the expression can be used
- * e.g. in a structure initializer (or where-ever else comma expressions
- * aren't permitted).
- */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:(-!!(e)); }))
-
-/*
* BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
* expression but avoids the generation of any code, even if that expression
* has side-effects.
@@ -52,23 +44,9 @@
* If you have some code which relies on certain constants being equal, or
* some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
* detect if someone changes it.
- *
- * The implementation uses gcc's reluctance to create a negative array, but gcc
- * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
- * inline functions). Luckily, in 4.3 they added the "error" function
- * attribute just for this type of case. Thus, we use a negative sized array
- * (should always create an error on gcc versions older than 4.4) and then call
- * an undefined function with the error attribute (should always create an
- * error on gcc 4.3 and later). If for some reason, neither creates a
- * compile-time error, we'll still have a link-time error, which is harder to
- * track down.
*/
-#ifndef __OPTIMIZE__
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#else
#define BUILD_BUG_ON(condition) \
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
-#endif
/**
* BUILD_BUG - break compile if used.
@@ -98,6 +76,4 @@
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
-#endif /* __CHECKER__ */
-
#endif /* _LINUX_BUILD_BUG_H */
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index a7f546f..c732eef 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -14,13 +14,7 @@
#include <linux/types.h>
#endif
-#ifndef __CHECKER__
#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
-#endif
-#endif
+#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
#endif
diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts
index 2561025..5e2429c 100644
--- a/scripts/Makefile.dts
+++ b/scripts/Makefile.dts
@@ -1,3 +1,3 @@
# SPDX-License-Identifier: GPL-2.0+
-dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_$(SPL_)OF_LIST)))
+dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE) $(CONFIG_OF_LIST) $(CONFIG_SPL_OF_LIST)))
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7b27224..7362a39 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -331,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
; \
sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
-$(obj)/%.dtb: $(src)/%.dts FORCE
+$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
$(call if_changed_dep,dtc)
pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
@@ -351,7 +351,10 @@ cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
-$(obj)/%.dtbo: $(src)/%.dts FORCE
+$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
+ $(call if_changed_dep,dtco)
+
+$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
$(call if_changed_dep,dtco)
# Fonts
diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh
index bfb514e..53ff868 100755
--- a/scripts/dtc-version.sh
+++ b/scripts/dtc-version.sh
@@ -20,7 +20,7 @@ if ! which $dtc >/dev/null ; then
exit 1
fi
-MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1 | tr -d v)
MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2)
PATCH=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 3 | cut -d - -f 1)