WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] build fixes for cross-compiling

To: Jan Beulich <JBeulich@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] build fixes for cross-compiling
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 29 Sep 2011 09:00:41 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Adin Scannell <adin@xxxxxxxxxxxxxxx>
Delivery-date: Thu, 29 Sep 2011 01:04:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E843DBD020000780005865C@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <CAAJKtqre0Q3qbngZi01NfmSQSh0YXtSyS4LZc=cOQt98Xqzcyw@xxxxxxxxxxxxxx> <4E843DBD020000780005865C@xxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-09-29 at 08:43 +0100, Jan Beulich wrote:
> >>> On 28.09.11 at 23:31, Adin Scannell <adin@xxxxxxxxxxxxxxx> wrote:
> > I always have problems cross-compiling tools (I build everything on a
> > 64-bit machine and generally target a 32-bit host), because all the
> > link steps are missing targets.  I've use this tiny patch on the base
> > of my workspaces.
> > 
> > To my knowledge, this doesn't break anything -- but who knows with
> > builds, particularly cross-compiling. I just thought I'd throw this
> > there in case others have the same issue and it doesn't affect
> > standard build environments.
> 
> Are you saying this actually works for you (building everything, not just
> the tools)?
> 
> I do cross builds too, but generally the other way around (64-bit
> build on 32-bit host), and hence need to only cross-build the
> hypervisor to put underneath everything.
> 
> > diff -r a422e2a4451e config/x86_32.mk
> > --- a/config/x86_32.mk
> > +++ b/config/x86_32.mk
> > @@ -8,6 +8,7 @@ CONFIG_XCUTILS := y
> >  CONFIG_IOEMU := y
> > 
> >  CFLAGS += -m32 -march=i686
> > +LDFLAGS += -m32 -march=i686
> 
> I can't seem to find an ld (native or cross) that would accept -m32,
> -march=i686, ...
> 
> >
> >  # Use only if calling $(LD) directly.
> >  LDFLAGS_DIRECT_OpenBSD = _obsd
> > diff -r a422e2a4451e config/x86_64.mk
> > --- a/config/x86_64.mk
> > +++ b/config/x86_64.mk
> > @@ -9,6 +9,7 @@ CONFIG_XCUTILS := y
> >  CONFIG_IOEMU := y
> > 
> >  CFLAGS += -m64
> > +LDFLAGS += -m64
> 
> ... or -m64. But $(LDFLAGS) gets passed to $(LD) when building Xen
> (other than for the tools, where generally $(CC) is used to do the
> linking).

This worked for me, the link line ends up as 

ld -m64   -melf_x86_64  -T xen.lds -N prelink.o \
            /local/scratch/ianc/devel/xen-unstable.hg/xen/.xen-x86_64-syms.1.o 
-o /local/scratch/ianc/devel/xen-unstable.hg/xen/xen-x86_64-syms

(the inclusion of the arch in the filename is a local patch)

This is with ld from Debian Squeeze:
$ ld --version
GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303

Ah, I think I see what's happening: the -melf... simply silently
overrides the -m64, just "ld -m64" gives errors as you suggested, so
does "ld -melf... -m64".

We have LDFLAGS_DIRECT, adding LDFLAGS_INDIRECT seems a bit gross
though... I wonder if perhaps LDFLAGS and LDFLAGS_DIRECT should be
mut8lly exclusive, i.e. direct calls to the linker use only the latter
and not both?

Ian.

> 
> Jan
> 
> > 
> >  LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
> >  LIBDIR = $(LIBDIR_x86_64)
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel