1# SPDX-License-Identifier: GPL-2.0
2
3quiet_cmd_chkbss = CHKBSS  $<
4define cmd_chkbss
5	rm -f $@; \
6	if ! $(OBJDUMP) -j .bss -w -h $< | awk 'END { if ($$3) exit 1 }'; then \
7		echo "error: $< .bss section is not empty" >&2; exit 1; \
8	fi; \
9	touch $@;
10endef
11
12chkbss-target ?= $(obj)/built-in.a
13ifneq (,$(findstring /,$(chkbss)))
14chkbss-files := $(patsubst %, %.chkbss, $(chkbss))
15else
16chkbss-files := $(patsubst %, $(obj)/%.chkbss, $(chkbss))
17endif
18
19$(chkbss-target): $(chkbss-files)
20targets += $(notdir $(chkbss-files))
21
22%.o.chkbss: %.o
23	$(call cmd,chkbss)
24