From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vl0zl-00026l-Cz for mharc-grub-devel@gnu.org; Mon, 25 Nov 2013 13:34:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl0zf-00026O-8p for grub-devel@gnu.org; Mon, 25 Nov 2013 13:34:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl0za-0000fw-9S for grub-devel@gnu.org; Mon, 25 Nov 2013 13:34:47 -0500 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]:55472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl0zZ-0000fX-Sb for grub-devel@gnu.org; Mon, 25 Nov 2013 13:34:42 -0500 Received: by mail-lb0-f170.google.com with SMTP id w7so3538619lbi.15 for ; Mon, 25 Nov 2013 10:34:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=1lQ1tdZRaTLeoveY7RsU+GVKeh04SljLJZBelwIF6TE=; b=bc2Ejx2ZAVKkkuuTh2a3uP3rFmUninShtKM2X09DZeSr6/fkJCYlFJ9m4jv9kxO/is OYfmR78wC31dU+PyGv8eDSxDvY/w22Hen2rjMzXKzumyfT9pVn1W+Qh1xVMT6ZJAlrh1 qb4SucuPMpACbhSef0+9MYxSK2pJaYN0MBS4YAXCXGAw6uyOAN8JYbB/iKlE57vqw4Lu Z0z0uFBqyKPbNXKQ30XZLgaqSFKDqTTa0HW4kYNQrsS6sXrCo2eLavcuJeZTPjlyKhS9 L8vvXmPekBZC7i0ordZkJQatPoTLKh710yF2vfkgAKXN4jhm/JV5lHwFv233xySJ6xI/ 70hQ== X-Received: by 10.152.115.230 with SMTP id jr6mr1665435lab.45.1385404480541; Mon, 25 Nov 2013 10:34:40 -0800 (PST) Received: from opensuse.site (ppp91-76-170-113.pppoe.mtu-net.ru. [91.76.170.113]) by mx.google.com with ESMTPSA id c10sm35796835lbd.9.2013.11.25.10.34.39 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 25 Nov 2013 10:34:39 -0800 (PST) Date: Mon, 25 Nov 2013 22:34:38 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module Message-ID: <20131125223439.0b069f1a@opensuse.site> In-Reply-To: <52939494.3040307@gmail.com> References: <52938E36.40405@gmail.com> <1385403222-20943-1-git-send-email-arvidjaar@gmail.com> <52939494.3040307@gmail.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/VPkE_wtxXrgPxlSmmJiYd2s"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22a 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 18:34:52 -0000 --Sig_/VPkE_wtxXrgPxlSmmJiYd2s Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Mon, 25 Nov 2013 19:19:00 +0100 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 25.11.2013 19:13, 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. > Go ahead Committed with additional comment in grub-core/Makefile.am that -arch,x86_64 =3D=3D Apple linker > >=20 > > Reported-By: Beeblebrox > > --- > > configure.ac | 29 +++++++++++++++++++++++++++-- > > grub-core/Makefile.am | 9 ++++----- > > 2 files changed, 31 insertions(+), 7 deletions(-) > >=20 > > diff --git a/configure.ac b/configure.ac > > index d1292c9..1989f87 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 -arch,x86_64; do > > + CFLAGS=3D"-m64 -nostdlib -O2 -mcmodel=3Dlarge -mno-red-zone" > > + LDFLAGS=3D"-m64 -Wl,$format -nostdlib -static" > > + 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; then > > + 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,${targe= t_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..3ca52ea 100644 > > --- a/grub-core/Makefile.am > > +++ b/grub-core/Makefile.am > > @@ -399,7 +399,7 @@ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2EL= F) > > fi > > =20 > > efiemu64_c.o: efiemu/runtime/efiemu.c > > - if test "x$(TARGET_APPLE_LINKER)" =3D x1; then \ > > + if test "x$(EFIEMU64_LINK_FORMAT)" =3D x-arch,x86_64; then \ > > $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFA= ULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \ > > else \ > > $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFA= ULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=3Dlarge -mno-red-zone -c -o = $@ $< || exit 1; \ > > @@ -407,7 +407,7 @@ efiemu64_c.o: efiemu/runtime/efiemu.c > > =20 > > efiemu64_s.o: efiemu/runtime/efiemu.S > > -rm -f $@ > > - if test "x$(TARGET_APPLE_LINKER)" =3D x1; then \ > > + if test "x$(EFIEMU64_LINK_FORMAT)" =3D x-arch,x86_64; then \ > > $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFA= ULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \ > > else \ > > $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFA= ULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=3Dlarge -mno-red-zone -c -o = $@ $< || exit 1; \ > > @@ -415,14 +415,13 @@ efiemu64_s.o: efiemu/runtime/efiemu.S > > =20 > > efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF) > > -rm -f $@; \ > > - if test "x$(TARGET_APPLE_LINKER)" =3D x1; then \ > > + if test "x$(EFIEMU64_LINK_FORMAT)" =3D x-arch,x86_64; then \ > > rm -f $@.bin; \ > > $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \ > > $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \ > > rm -f $@.bin; \ > > else \ > > - $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exi= t 1; \ > > - if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm = -f $@; exit 1); fi; \ > > + $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^= || exit 1; \ > > fi > > =20 > > platform_DATA +=3D efiemu32.o efiemu64.o > >=20 >=20 >=20 --Sig_/VPkE_wtxXrgPxlSmmJiYd2s Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlKTmD8ACgkQR6LMutpd94yCyACgyr/PK8TcnhQl01If8OsmZjvF 6tgAoLzv2CzbBcoliVdJU8irFjthvlie =OpNa -----END PGP SIGNATURE----- --Sig_/VPkE_wtxXrgPxlSmmJiYd2s--