[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] optionrom: fix compilation with mingw docker ta
Re: [Qemu-devel] [PATCH] optionrom: fix compilation with mingw docker target
Tue, 9 Aug 2016 18:09:19 -0400 (EDT)
----- Original Message -----
> From: "Peter Maydell" <address@hidden>
> To: "Paolo Bonzini" <address@hidden>
> Cc: "QEMU Developers" <address@hidden>, "Richard W.M. Jones" <address@hidden>
> Sent: Tuesday, August 9, 2016 11:47:17 PM
> Subject: Re: [Qemu-devel] [PATCH] optionrom: fix compilation with mingw
> docker target
> On 9 August 2016 at 21:56, Paolo Bonzini <address@hidden> wrote:
> > Two fixes are needed. First, mingw does not have -D_FORTIFY_SOURCE,
> > hence --enable-debug disables optimization. This is not acceptable
> > for ROMs, which should override CFLAGS to force inclusion of -O2.
> > Second, PE stores global constructors and destructors using the
> > following linker script snippet:
> > ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
> > LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));
> > LONG (0);
> > ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
> > LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));
> > LONG (0);
> > The LONG directives cause the .img files to be 16 bytes too large;
> > the recently added check to signrom.py catches this. To fix this,
> > replace -T and -e options with a linker script.
> ...this is really starting to strongly suggest to me that we should
> not be trying to build our ROM images with whatever random
> maybe-this-is-an-x86-compiler $CC happens to be...
Well, to be precise the problems are in the linker (both the "emulation"
thing to this one), not the compiler. That's where most of the variability
is between OSes indeed, but the GNU linker is very customizable. So
after this patch this is looking a lot like what firmware build systems
do (and kvm-unit-tests too), which is in some sense a good sign.
If anything, pc-bios/ should be separately configured and should not use
anything from the output of the toplevel configure script. That's a
different project and would let everyone compile all ROMs locally just
by installing a suitable cross-compiler. It would be nice to have...