From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXFDD-0006eE-M9 for qemu-devel@nongnu.org; Tue, 09 Aug 2016 18:09:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXFD8-0001nJ-LZ for qemu-devel@nongnu.org; Tue, 09 Aug 2016 18:09:26 -0400 Received: from mx5-phx2.redhat.com ([209.132.183.37]:50873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXFD8-0001n4-DH for qemu-devel@nongnu.org; Tue, 09 Aug 2016 18:09:22 -0400 Date: Tue, 9 Aug 2016 18:09:19 -0400 (EDT) From: Paolo Bonzini Message-ID: <352977733.706609.1470780559595.JavaMail.zimbra@redhat.com> In-Reply-To: References: <1470776205-94166-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] optionrom: fix compilation with mingw docker target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , "Richard W.M. Jones" ----- Original Message ----- > From: "Peter Maydell" > To: "Paolo Bonzini" > Cc: "QEMU Developers" , "Richard W.M. Jones" > 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 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... Paolo