From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vknhf-0007bB-7X for mharc-grub-devel@gnu.org; Sun, 24 Nov 2013 23:23:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VknhZ-0007ai-I8 for grub-devel@gnu.org; Sun, 24 Nov 2013 23:23:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VknhU-0008Hk-Ob for grub-devel@gnu.org; Sun, 24 Nov 2013 23:23:13 -0500 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:54110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VknhU-0008Hg-EK for grub-devel@gnu.org; Sun, 24 Nov 2013 23:23:08 -0500 Received: by mail-wg0-f41.google.com with SMTP id y10so709111wgg.4 for ; Sun, 24 Nov 2013 20:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=hr5b3fAWX83tRIUawnvAWvOiyyy2/jBD0EbCSTKYyqI=; b=mcNuEGrt+fEOtCegRoCo+p4x8Rlxvv1z9xNhUfDkSYKD/nhAL1OHpTdfXBTEszGXB5 +EVcRrW1ph5bL1m0wfK8T0mmmZjndJHc8x6s2zMlsApnGJl4o+bv4fDlLAFng+++DNm/ 6FpGEP1XYOajyyUr1OdPAxfnwxzGxaSQN72g+P64LtoP42xVEzL3yoobnzLrbwwDxnw6 VGu0IYsLVEzw6MAjwi+bKvimMZeYrAiXUc/DZ+28ThBmmg1amfH8Q3+9rqirH3+k97Nf oWWTYbwRDtxOszX4XX7zmOqSARdxu4cAnpuCWOPNZV2ocdMkMMdgIbtL8/9dKf8QgcLK ZCOg== X-Received: by 10.180.184.14 with SMTP id eq14mr11940705wic.56.1385353387485; Sun, 24 Nov 2013 20:23:07 -0800 (PST) Received: from [192.168.1.121] (31-249.1-85.cust.bluewin.ch. [85.1.249.31]) by mx.google.com with ESMTPSA id a19sm44505205wib.1.2013.11.24.20.23.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Nov 2013 20:23:06 -0800 (PST) Message-ID: <5292D0A2.8040301@gmail.com> Date: Mon, 25 Nov 2013 05:22:58 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] Explicitly check for linking format to use for efiemu64 module References: <1385313664-5982-1-git-send-email-arvidjaar@gmail.com> In-Reply-To: <1385313664-5982-1-git-send-email-arvidjaar@gmail.com> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="----enig2HKTRBEPITQFMWDCETXJB" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::229 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Nov 2013 04:23:18 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2HKTRBEPITQFMWDCETXJB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 24.11.2013 18:21, Andrey Borzenkov wrote: > Similar to check for target linking format, also check for efiemu64 > instead of hardcoding -melf_x86_64. This fixes compilation on *BSD > variants. We cannot easily reuse main target check because platforms > are different (main target is 32 bit and efiemu64 - 64 bit). >=20 > This commit adds EFIEMU64_LINK_FORMAT that contains detected > link option and is used in efiemu64.o linking instead of hardcoded > value. >=20 > Reported-By: Beeblebrox > --- >=20 > Could you test this patch? >=20 > configure.ac | 29 +++++++++++++++++++++++++++-- > grub-core/Makefile.am | 2 +- > 2 files changed, 28 insertions(+), 3 deletions(-) >=20 > diff --git a/configure.ac b/configure.ac > index 8619a67..be558de 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -654,6 +654,30 @@ if test x"$efiemu_excuse" =3D x ; then > efiemu_excuse=3D"cannot compile with -m64 -mcmodel=3Dlarge -mno-r= ed-zone -nostdlib" > fi > fi > +if test x"$efiemu_excuse" =3D x ; then > + AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efi= emu64_link_format], [ > + grub_cv_target_cc_efiemu64_link_format=3Dunknown > + for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -me= lf_x86_64_haiku -mx86_64pe -arch,x86_64; do As in other mail: remove -mx86_64pe > + CFLAGS=3D"-m64 -nostdlib -O2 -mcmodel=3Dlarge -mno-red-zone" > + LDFLAGS=3D"-m64 -Wl,$format -nostdlib" You need -static as otherwise on Apple systems it will try to pull in the dynamic linker which we don't want (scratch comment about other thread, I though of adding -static everywhere but it's no necessarry after all) > + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ > + asm (".globl start; start:"); > + asm (".globl _start; _start:"); > + asm (".globl __start; __start:"); > + void __main (void); > + void __main (void) {} > + ]], [[]])], [flag=3D1], [flag=3D0]) > + if test x"$flag" =3D x1; then > + grub_cv_target_cc_efiemu64_link_format=3D"$format" > + break; > + fi > + done]) > + if test x"$grub_cv_target_cc_efiemu64_link_format" =3D xunknown; the= n > + efiemu_excuse=3D"no suitable link format for efiemu64 found" > + else > + EFIEMU64_LINK_FORMAT=3D"-Wl,$grub_cv_target_cc_efiemu64_link_forma= t" > + fi > +fi > if test x"$enable_efiemu" =3D xyes && test x"$efiemu_excuse" !=3D x ; = then > AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be c= ompiled]) > fi > @@ -663,11 +687,12 @@ else > enable_efiemu=3Dno > fi > AC_SUBST([enable_efiemu]) > +AC_SUBST([EFIEMU64_LINK_FORMAT]) > =20 > CFLAGS=3D"$TARGET_CFLAGS" > =20 > if test x"$target_cpu" =3D xi386 || test x"$target_cpu" =3D xx86_64; t= hen > - AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format]= , [ > + AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_= format], [ > grub_cv_target_cc_link_format=3Dunknown > for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_$= {target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${tar= get_cpu}; do > if test x${target_cpu} !=3D xi386 && test x$format =3D x${target= _cpu}pe; then > @@ -681,7 +706,7 @@ if test x"$target_cpu" =3D xi386 || test x"$target_= cpu" =3D xx86_64; then > asm (".globl __start; __start:"); > void __main (void); > void __main (void) {} > - ]], [[]])], [flag=3D1], []) > + ]], [[]])], [flag=3D1], [flag=3D0]) > if test x"$flag" =3D x1; then > grub_cv_target_cc_link_format=3D"$format" > break; > diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am > index e2da083..e6862b7 100644 > --- a/grub-core/Makefile.am > +++ b/grub-core/Makefile.am > @@ -421,7 +421,7 @@ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2= ELEF) > $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \ > rm -f $@.bin; \ Here the check for apple linker has to be adjusted as x$(EFIEMU64_LINK_FORMAT) =3D x-arch,x86_64 > else \ > - $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exi= t 1; \ > + $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^= || exit 1; \ > if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm = -f $@; exit 1); fi; \ Remove TARGET_OBJ2ELF part as it's for 32-bit and we don't use PE here. > fi > =20 >=20 ------enig2HKTRBEPITQFMWDCETXJB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKS0KkACgkQmBXlbbo5nOsP/QD/RvF4v4m+TOq/HG/NPL696u1f bBCzbOH1mRxMeBvWzNUA/RhqFgjDS7t5jL58joukcA/j+bIsG3GYe5Rzm9QRuVT5 =cGRI -----END PGP SIGNATURE----- ------enig2HKTRBEPITQFMWDCETXJB--