mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-04 02:20:25 +00:00
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.
This commit is contained in:
commit
5d0b3dde11
6 changed files with 21 additions and 44 deletions
6
Makefile
6
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)
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
@ -20,15 +21,6 @@
|
|||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
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
|
||||
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue