From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: Re: Clang/LLVM version requirements Date: Thu, 13 Sep 2012 11:11:20 +0100 Message-ID: <20120913101120.GA12881@ocelot.phlegethon.org> References: <20120907085036.GA71093@ocelot.phlegethon.org> <5049E2C70200007800099B21@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <5049E2C70200007800099B21@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Jeffrey Karrels , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 11:04 +0100 on 07 Sep (1347015863), Jan Beulich wrote: > >>> On 07.09.12 at 10:50, Tim Deegan wrote: > > Jan, would you object to some other way of checking for .bss in reloc.c? > > No, if you have a better idea. > > > Could we just objcopy it out so any BSS symbols make it fail at link > > time? > > Would that reliably fail with all linker versions? > > > In any case we probably ought to check for stray .data symbols too. > > Not really, no. Those would still be present in reloc.bin, and > hence make it into reloc.S. But they would break the test, because the magic alignment happens in .text, right? Anyway, compile-time failure seems more useful. How about this, based on the similar checks for init-only files? # HG changeset patch # Parent 5691e4cc17da7fe8664a67f1d07c3755c0ca34ed x86: check for BSS in reloc code at compile time. This is a more helpful failure mode than hanging at boot time, and incidentally fixes the clang/LLVM build by removing a .subsection rune. Signed-off-by: Tim Deegan diff -r 5691e4cc17da xen/arch/x86/boot/build32.mk --- a/xen/arch/x86/boot/build32.mk Thu Sep 13 10:23:17 2012 +0200 +++ b/xen/arch/x86/boot/build32.mk Thu Sep 13 11:04:29 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 \ + .bss|.bss.*) \ + test $$sz != 0 || continue; \ + echo "Error: non-empty BSS: 0x$$sz" >&2; \ + exit $$(expr $$idx + 1);; \ + esac; \ + done reloc.o: $(BASEDIR)/include/asm-x86/config.h .PRECIOUS: %.bin %.lnk diff -r 5691e4cc17da xen/arch/x86/boot/reloc.c --- a/xen/arch/x86/boot/reloc.c Thu Sep 13 10:23:17 2012 +0200 +++ b/xen/arch/x86/boot/reloc.c Thu Sep 13 11:04:29 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;