xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jeffrey Karrels <karrelsj@gmail.com>,
	xen-devel@lists.xen.org
Subject: Re: Clang/LLVM version requirements
Date: Thu, 13 Sep 2012 15:55:24 +0100	[thread overview]
Message-ID: <20120913145524.GD12881@ocelot.phlegethon.org> (raw)
In-Reply-To: <50520368020000780009B128@nat28.tlf.novell.com>

At 15:01 +0100 on 13 Sep (1347548504), Jan Beulich wrote:
> >>> On 13.09.12 at 14:21, Tim Deegan <tim@xen.org> wrote:
> > Allowing BSS would just need a few extra runes (AFAICS,
> > "--set-section-flags .bss=alloc,load,contents") in the objcopy that
> > makes reloc.bin.
> >  But I'm not sure how to make sure everything is
> > rip-relative, do if that's the real concern I'm inclined to go with
> > this compile-time check and exclude .[ro]data[.*] as well.
> > We can always fix it up to allow bss and data sections if we ever
> > actually need them.
> 
> As said, I'm fine with any approach as long as it works with all
> supported tool chains. So feel free to go the route you're
> proposing.

OK.  The patch below works for me on gccs 4.1 to 4.7 and clang 3.0.
I tries gcc 3.4 but the build already fails in a few other places.
Do we really still support gcc 3.4 like the README says?

Can I have an Ack, or would you like to apply it yourself?

Tim.

# HG changeset patch
# Parent 9e46d90d0182979a7220314ca19d2525e338aa5d
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>

diff -r 9e46d90d0182 xen/arch/x86/boot/build32.mk
--- a/xen/arch/x86/boot/build32.mk	Thu Sep 13 15:00:26 2012 +0100
+++ b/xen/arch/x86/boot/build32.mk	Thu Sep 13 15:04:32 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 9e46d90d0182 xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c	Thu Sep 13 15:00:26 2012 +0100
+++ b/xen/arch/x86/boot/reloc.c	Thu Sep 13 15:04:32 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;

  reply	other threads:[~2012-09-13 14:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 22:32 Clang/LLVM version requirements Jeffrey Karrels
2012-09-07  8:50 ` Tim Deegan
2012-09-07 10:04   ` Jan Beulich
2012-09-13 10:11     ` Tim Deegan
2012-09-13 11:52       ` Jan Beulich
2012-09-13 12:21         ` Tim Deegan
2012-09-13 14:01           ` Jan Beulich
2012-09-13 14:55             ` Tim Deegan [this message]
2012-09-13 15:05               ` Keir Fraser
2012-09-13 15:09                 ` Keir Fraser
2012-09-13 15:27                   ` Ian Campbell
2012-09-13 15:51                     ` Keir Fraser
2012-09-13 15:22                 ` Jan Beulich
2012-09-13 15:34                   ` Keir Fraser
2012-09-13 15:06               ` Jan Beulich
2012-09-13 12:40         ` Paolo Bonzini
2012-09-13 14:04           ` Jan Beulich
2012-09-13 14:13             ` Paolo Bonzini
2012-09-13 14:18               ` Jan Beulich
2012-09-07 15:58   ` Jeffrey Karrels
2012-09-11 18:43     ` Jeffrey Karrels
2012-09-12 10:24       ` Stefano Stabellini
2012-09-13 16:15         ` Ian Jackson
2012-09-13 16:41           ` Tim Deegan
2012-09-13 17:04             ` Ian Jackson
2012-09-12 10:31       ` Tim Deegan
2012-09-12 10:38         ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120913145524.GD12881@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=karrelsj@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).