Skip to content

Commit

Permalink
s390: introduce compile time check for empty .bss section
Browse files Browse the repository at this point in the history
Introduce compile time check for files which should avoid using .bss
section, because of the following reasons:
- .bss section has not been zeroed yet,
- initrd has not been moved to a safe location and could be overlapping
with .bss section.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Vasily Gorbik authored and Martin Schwidefsky committed May 9, 2018
1 parent 971a9ca commit 0391fcb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/s390/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ obj-$(CONFIG_TRACEPOINTS) += trace.o
# vdso
obj-y += vdso64/
obj-$(CONFIG_COMPAT) += vdso32/

chkbss := head.o head64.o als.o early_nobss.o
include $(srctree)/arch/s390/scripts/Makefile.chkbss
3 changes: 3 additions & 0 deletions arch/s390/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ obj-y += mem.o xor.o
lib-$(CONFIG_SMP) += spinlock.o
lib-$(CONFIG_KPROBES) += probes.o
lib-$(CONFIG_UPROBES) += probes.o

chkbss := mem.o
include $(srctree)/arch/s390/scripts/Makefile.chkbss
14 changes: 14 additions & 0 deletions arch/s390/scripts/Makefile.chkbss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0

quiet_cmd_chkbss = CHKBSS $<
define cmd_chkbss
if ! $(OBJDUMP) -j .bss -w -h $< | awk 'END { if ($$3) exit 1 }'; then \
echo "error: $< .bss section is not empty" >&2; exit 1; \
fi; \
touch $@;
endef

$(obj)/built-in.a: $(patsubst %, $(obj)/%.chkbss, $(chkbss))

%.o.chkbss: %.o
$(call cmd,chkbss)
3 changes: 3 additions & 0 deletions drivers/s390/char/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ obj-$(CONFIG_CRASH_DUMP) += sclp_sdias.o zcore.o

hmcdrv-objs := hmcdrv_mod.o hmcdrv_dev.o hmcdrv_ftp.o hmcdrv_cache.o diag_ftp.o sclp_ftp.o
obj-$(CONFIG_HMC_DRV) += hmcdrv.o

chkbss := sclp_early_core.o
include $(srctree)/arch/s390/scripts/Makefile.chkbss

0 comments on commit 0391fcb

Please sign in to comment.