Received: from eggs.gnu.org ([2001:4830:134:3::10]:55926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWovU-0002FM-JA for qemu-devel@nongnu.org; Mon, 08 Aug 2016 14:05:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWovR-0001th-65 for qemu-devel@nongnu.org; Mon, 08 Aug 2016 14:05:24 -0400 Received: from ignoranthack.me ([199.102.79.106]:52107 helo=mail.ignoranthack.me) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWovQ-0001tc-TY for qemu-devel@nongnu.org; Mon, 08 Aug 2016 14:05:21 -0400 References: <1470672688-6754-1-git-send-email-peter.maydell@linaro.org> From: Sean Bruno Message-ID: <95d90ca9-032a-9e67-27ae-6942fa4eaa25@freebsd.org> Date: Mon, 8 Aug 2016 12:05:14 -0600 MIME-Version: 1.0 In-Reply-To: <1470672688-6754-1-git-send-email-peter.maydell@linaro.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9I7mLjq538RSrXnD9So4kpRbNaVhQBLGu" Subject: Re: [Qemu-devel] [PATCH for-2.7] pc-bios/optionrom: Fix OpenBSD build with better detection of linker emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Paolo Bonzini , Brad Smith , patches@linaro.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9I7mLjq538RSrXnD9So4kpRbNaVhQBLGu From: Sean Bruno To: Peter Maydell , qemu-devel@nongnu.org Cc: Paolo Bonzini , Brad Smith , patches@linaro.org Message-ID: <95d90ca9-032a-9e67-27ae-6942fa4eaa25@freebsd.org> Subject: Re: [Qemu-devel] [PATCH for-2.7] pc-bios/optionrom: Fix OpenBSD build with better detection of linker emulation References: <1470672688-6754-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1470672688-6754-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 08/08/16 10:11, Peter Maydell wrote: > The various host OSes are irritatingly variable about the name > of the linker emulation we need to pass to ld's -m option to > build the i386 option ROMs. Instead of doing this via a > CONFIG ifdef, check in configure whether any of the emulation > names we know about will work and pass the right answer through > to the makefile. If we can't find one, we fall back to not trying > to build the option ROMs, in the same way we would for a non-x86 > host platform. >=20 > This is in particular necessary to unbreak the build on OpenBSD, > since it wants a different answer to FreeBSD and we don't have > an existing CONFIG_ variable that distinguishes the two. >=20 Reviewed-by: Sean Bruno For impact to FreeBSD only. > Signed-off-by: Peter Maydell > --- > This works for Linux and for the Windows builds; I don't have any > BSD systems to test it on. Brad and Sean, can I ask you to test this > on OpenBSD and FreeBSD, please? >=20 > (I think this is going to miss -rc2. Sorry about that; we'll > get OpenBSD builds fixed for -rc3.) >=20 > configure | 12 +++++++++++- > pc-bios/optionrom/Makefile | 12 +----------- > 2 files changed, 12 insertions(+), 12 deletions(-) >=20 > diff --git a/configure b/configure > index f57fcc6..7c744ad 100755 > --- a/configure > +++ b/configure > @@ -4699,7 +4699,16 @@ roms=3D > if test \( "$cpu" =3D "i386" -o "$cpu" =3D "x86_64" \) -a \ > "$targetos" !=3D "Darwin" -a "$targetos" !=3D "SunOS" -a \ > "$softmmu" =3D yes ; then > - roms=3D"optionrom" > + # Different host OS linkers have different ideas about the name of= the ELF > + # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _f= bsd > + # variant; and Windows uses i386pe. > + for emu in elf_i386 elf_i386_fbsd i386pe; do > + if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]= *$"; then > + ld_i386_emulation=3D"$emu" > + roms=3D"optionrom" > + break > + fi > + done > fi > if test "$cpu" =3D "ppc64" -a "$targetos" !=3D "Darwin" ; then > roms=3D"$roms spapr-rtas" > @@ -5539,6 +5548,7 @@ fi > echo "LDFLAGS=3D$LDFLAGS" >> $config_host_mak > echo "LDFLAGS_NOPIE=3D$LDFLAGS_NOPIE" >> $config_host_mak > echo "LD_REL_FLAGS=3D$LD_REL_FLAGS" >> $config_host_mak > +echo "LD_I386_EMULATION=3D$ld_i386_emulation" >> $config_host_mak > echo "LIBS+=3D$LIBS" >> $config_host_mak > echo "LIBS_TOOLS+=3D$libs_tools" >> $config_host_mak > echo "PTHREAD_LIB=3D$PTHREAD_LIB" >> $config_host_mak > diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile > index 24e175e..5bbe233 100644 > --- a/pc-bios/optionrom/Makefile > +++ b/pc-bios/optionrom/Makefile > @@ -41,18 +41,8 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma= =2Ebin kvmvapic.bin > %.o: %.S > $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - = $< | $(AS) $(ASFLAGS) -o $@," AS $(TARGET_DIR)$@") > =20 > -ifdef CONFIG_WIN32 > -LD_EMULATION =3D i386pe > -else > -ifdef CONFIG_BSD > -LD_EMULATION =3D elf_i386_fbsd > -else > -LD_EMULATION =3D elf_i386 > -endif > -endif > - > %.img: %.o > - $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -Ttext= 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") > + $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -= Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") > =20 > %.raw: %.img > $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building = $(TARGET_DIR)$@") >=20 --9I7mLjq538RSrXnD9So4kpRbNaVhQBLGu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAEBCgBmBQJXqMnaXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kXX4H/1bymXJu2kXsevYkulq3DZP4 mhCNBV3qywOXJY3/MCyhmsUlcs1WtAV1kv9M8Y13ZwLTf1VSqo1itt1jspDxJRZA nRTnVBgHuh83icyNS8Vigr4k16g1NpQ67Y9z6/zXBMSmsdvGuTzhS3lP4bpApniE 3cDU6OlERj1r6nfOz303MXfDwMuN4wrOiHXwywx+IlbT7QGq7/bOXkq5+yWsKVIH x57sczjGf6XjD1aJiivz2VoUSb8AoXQgOMyqgFeAh+nu8L9sjOspX1YxWTALtxPd X9NED8yO2CENJwzwUh/W4BuNDayvHwqLE7wuxTjmJMSHGvUyW2TaSSj2+QaqTT4= =VByh -----END PGP SIGNATURE----- --9I7mLjq538RSrXnD9So4kpRbNaVhQBLGu--