|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: check for data and BSS in reloc code at compile time.
# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1347550893 -3600
# Node ID 4aa37a8fb32ae77beafb5ae9d6abd3878a2d4901
# Parent b3e6de36c91e9466498946cbb9a9e71c4efd5eae
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@xxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---
diff -r b3e6de36c91e -r 4aa37a8fb32a xen/arch/x86/boot/build32.mk
--- a/xen/arch/x86/boot/build32.mk Thu Sep 13 16:41:33 2012 +0100
+++ b/xen/arch/x86/boot/build32.mk Thu Sep 13 16:41:33 2012 +0100
@@ -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 -r b3e6de36c91e -r 4aa37a8fb32a xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c Thu Sep 13 16:41:33 2012 +0100
+++ b/xen/arch/x86/boot/reloc.c Thu Sep 13 16:41:33 2012 +0100
@@ -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;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |