[PATCH 1/4] purgatory: Add no-zero-initialized-in-bss flag

Geoff Levand geoff at infradead.org
Wed Mar 18 16:04:03 PDT 2015


It seems some toolchains will put zero-initialized variables like purgatory's
sha256_regions into the BSS section.  These symbols cannot be processed by
machine_apply_elf_rel() and lead to build errors.  To avoid this problem add
the compiler flag no-zero-initialized-in-bss to the purgatory CFLAGS.

Fixes build errors like these:

  Symbol: sha256_regions is in a bss section cannot set

Reported here:

  http://lists.infradead.org/pipermail/kexec/2014-November/013052.html

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 purgatory/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/purgatory/Makefile b/purgatory/Makefile
index 1945702..1c7d2c0 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -47,7 +47,8 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
 $(PURGATORY): CC=$(TARGET_CC)
 $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
 		      $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
-		      -Os -fno-builtin -ffreestanding
+		      -Os -fno-builtin -ffreestanding \
+		      -fno-zero-initialized-in-bss
 
 $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 			-I$(srcdir)/purgatory/include \
-- 
2.1.0





More information about the kexec mailing list