aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/boot
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2012-09-13 16:41:33 +0100
committerTim Deegan <tim@xen.org>2012-09-13 16:41:33 +0100
commitc53cc61d06179d1c44755644100c7359cb8e583b (patch)
tree87849fea46eee6d3a981466c80ecb6f2c0d2c0d6 /xen/arch/x86/boot
parent8d6aa80e4f75c81edff33f1822140237148528b6 (diff)
downloadxen-c53cc61d06179d1c44755644100c7359cb8e583b.tar.gz
xen-c53cc61d06179d1c44755644100c7359cb8e583b.tar.bz2
xen-c53cc61d06179d1c44755644100c7359cb8e583b.zip
x86: check for data and BSS in reloc code at compile time.
This is a more useful failure mode than hanging at boot time, and incidentally fixes the clang/LLVM build by removing a .subsection rune. Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Jan Beulich <jbeulich@suse.com> Committed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'xen/arch/x86/boot')
-rw-r--r--xen/arch/x86/boot/build32.mk9
-rw-r--r--xen/arch/x86/boot/reloc.c8
2 files changed, 10 insertions, 7 deletions
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 5401b07050..a2d4b34244 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -20,6 +20,15 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
%.o: %.c
$(CC) $(CFLAGS) -c -fpic $< -o $@
+ $(OBJDUMP) -h $@ | sed -n '/[0-9]/{s,00*,0,g;p}' |\
+ while read idx name sz rest; do \
+ case "$$name" in \
+ .data|.data.*|.rodata|.rodata.*|.bss|.bss.*) \
+ test $$sz != 0 || continue; \
+ echo "Error: non-empty $$name: 0x$$sz" >&2; \
+ exit $$(expr $$idx + 1);; \
+ esac; \
+ done
reloc.o: $(BASEDIR)/include/asm-x86/config.h
.PRECIOUS: %.bin %.lnk
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index ea94bf17a5..fa0fb6bfb3 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -18,10 +18,7 @@ asm (
" call 1f \n"
"1: pop %ebx \n"
" mov %eax,alloc-1b(%ebx) \n"
- " mov $_end,%ecx \n" /* check that BSS is empty! */
- " sub $__bss_start,%ecx \n"
- " jz reloc \n"
- "1: jmp 1b \n"
+ " jmp reloc \n"
);
/* This is our data. Because the code must be relocatable, no BSS is
@@ -30,9 +27,6 @@ asm (
asm (
"alloc: \n"
" .long 0 \n"
- " .subsection 1 \n"
- " .p2align 4, 0xcc \n"
- " .subsection 0 \n"
);
typedef unsigned int u32;