Minor purgatory updates
Subsystems (2)
cover Minor purgatory updates
Hi Simon,
Here are a few minor updates for purgatory. I think the no-zero-initialized-in-bss flag and the printf type checking should be considered seriously. The symbol and map files less important, but I found them useful in figuring out problems with purgatory.
-Geoff
The following changes since commit 236e30b2b4dcb3e78c5f5219b66d90c7e9c464fd:
kexec: iomem: fix callbacks params for sh and x86 archs (2015-02-25 13:41:32 +0900)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kexec-tools.git for-merge
for you to fetch changes up to 6859689cd7561950eda3a0fef52a2eedd22c14fb:
purgatory: Add printf type checking (2015-03-18 15:47:25 -0700)
----------------------------------------------------------------
Geoff Levand (4):
purgatory: Add no-zero-initialized-in-bss flag
purgatory: Generate symbol file
purgatory: Generate map file
purgatory: Add printf type checking
purgatory/Makefile | 12 +++++++----- purgatory/include/purgatory.h | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-)
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/4 purgatory: Add no-zero-initialized-in-bss flag
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
--- purgatory/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
purgatory/Makefile +2 -1
@@ -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 \
Signature · 8 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/4 purgatory: Generate symbol file
In reply to Geoff LevandTo aid in debugging purgatory update its makefile to generate a stand alone symbol file that can me loaded by a debugger.
--- purgatory/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
purgatory/Makefile +2 -3
@@ -63,10 +63,9 @@ $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\ $(PURGATORY): $(PURGATORY_OBJS) $(MKDIR) -p $(@D) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ - + $(CC) $(CFLAGS) $(LDFLAGS) -o [email protected] $^ # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) - $(STRIP) --strip-debug $@ + $(STRIP) --strip-debug -o $@ [email protected] echo:: @echo "PURGATORY_SRCS $(PURGATORY_SRCS)"
Signature · 8 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/4 purgatory: Generate map file
In reply to Geoff LevandTo aid in debugging purgatory and its relocation generate a linker map file when purgatory is built.
--- purgatory/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
purgatory/Makefile +3 -1
@@ -12,6 +12,7 @@ PURGATORY_SRCS = PURGATORY_SRCS += purgatory/purgatory.c PURGATORY_SRCS += purgatory/printf.c PURGATORY_SRCS += purgatory/string.c +PURGATORY_MAP = purgatory/purgatory.map dist += purgatory/Makefile $(PURGATORY_SRCS) \ purgatory/include/purgatory.h purgatory/include/string.h
@@ -59,7 +60,8 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ -I$(shell $(CC) -print-file-name=include) $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\ -Wl,--no-undefined -nostartfiles -nostdlib \ - -nodefaultlibs -e purgatory_start -r + -nodefaultlibs -e purgatory_start -r \ + -Wl,-Map=$(PURGATORY_MAP) $(PURGATORY): $(PURGATORY_OBJS) $(MKDIR) -p $(@D)
Signature · 8 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 4/4 purgatory: Add printf type checking
In reply to Geoff LevandTo better catch coding problems add stricter type checking to the purgatory printf routines.
--- purgatory/include/purgatory.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
purgatory/include/purgatory.h +3 -2
@@ -2,8 +2,9 @@#define PURGATORY_H void putchar (int ch); -void sprintf (char *buffer,const char *fmt, ...); -void printf (const char *fmt, ...); +void sprintf (char *buffer,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +void printf (const char *fmt, ...) __attribute__ ((format (printf,1 ,2 )));void setup_arch (void );void post_verification_setup_arch (void );
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 6 lines · Geoff Levand
Hi Simon,
Here are a few minor updates for purgatory. I think the no-zero-initialized-in-bss flag and the printf type checking should be considered seriously. The symbol and map files less important, but I found them useful in figuring out problems with purgatory.
Thanks Geoff,
these all seem reasonable to me. I have applied the entire series.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec