From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZFoT6-0005rZ-0Z for mharc-grub-devel@gnu.org; Thu, 16 Jul 2015 15:05:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFoT3-0005rQ-21 for grub-devel@gnu.org; Thu, 16 Jul 2015 15:05:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFoT1-0000Xx-MW for grub-devel@gnu.org; Thu, 16 Jul 2015 15:05:12 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:37376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFoT1-0000Xn-BV for grub-devel@gnu.org; Thu, 16 Jul 2015 15:05:11 -0400 Received: by wibud3 with SMTP id ud3so24644817wib.0 for ; Thu, 16 Jul 2015 12:05:10 -0700 (PDT) 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:cc:subject :references:in-reply-to:content-type; bh=nYLfLdADDz4zsY/SftYN6CvwdI+R3p9bu3DfTrulJsU=; b=aaOeuRdtOTk/rnugp45gmeYYpXDeTChgqN2QecRHGpFjrb0hSYfEtM7cdkwP22PEhs Nms67/l98OGFVLFbWhrrboCbPcTnXrVtTHfcNIqSxPXCXV6o66t08v7UY0uB2oEpkDn4 T/JDz21zeP8MyAuqIOV6Yua9oMurPIDXNeUgKu4hXbDXiVqgNoZym6iAvSVI75NvQ8lR XwDPUKUFAV3WOjc0X5xzaDh8ugWlLJQZ/ZzchYppHleLxqSXDjLv8yb5Jl9IF+f6TMWw cn0sXstCHjHT63beyVClsE0SZ4GqjIkUIRPThqQH+Vb4cYxhv4L9bRdwexqzIx+mx6OT PMUw== X-Received: by 10.180.19.197 with SMTP id h5mr9339027wie.45.1437073510564; Thu, 16 Jul 2015 12:05:10 -0700 (PDT) Received: from ?IPv6:2620:0:105f:fd00:863a:4bff:fe50:abc4? ([2620:0:105f:fd00:863a:4bff:fe50:abc4]) by smtp.gmail.com with ESMTPSA id ev8sm14543428wjb.8.2015.07.16.12.05.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 12:05:09 -0700 (PDT) Message-ID: <55A80063.2000902@gmail.com> Date: Thu, 16 Jul 2015 21:05:07 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Andrei Borzenkov Subject: Re: [PATCH 1/2] Add powerpc little-endian (ppc64le) flags References: <1435669013-3741-1-git-send-email-pfsmorigo@linux.vnet.ibm.com> <1435669013-3741-2-git-send-email-pfsmorigo@linux.vnet.ibm.com> <5592DA7A.8050107@linux.vnet.ibm.com> <20150630212856.12c56676@opensuse.site> <20150704094659.6aa48bf5@opensuse.site> <20150705203839.124984af@opensuse.site> <55A69B8F.4020105@gmail.com> <20150716215515.6a034cbd@opensuse.site> In-Reply-To: <20150716215515.6a034cbd@opensuse.site> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="s7l7maKhTtlmBDXrBQFJp0N7eWDJxgGa1" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::230 Cc: The development of GRUB 2 , Paulo Flabiano Smorigo 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: Thu, 16 Jul 2015 19:05:14 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --s7l7maKhTtlmBDXrBQFJp0N7eWDJxgGa1 Content-Type: multipart/mixed; boundary="------------050505020508080502010807" This is a multi-part message in MIME format. --------------050505020508080502010807 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 16.07.2015 20:55, Andrei Borzenkov wrote: > =D0=92 Wed, 15 Jul 2015 19:42:39 +0200 > Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0= =B8=D1=88=D0=B5=D1=82: >=20 >> >>> It is possible to compile using "--target=3Dpowerpc -Wl,-EB" - this w= orks >>> on all three ppc, ppc64 and ppc64le, but this means hardcoding GNU ld= >>> dependency. >>> >> Thanks for this info. >> See attached patch >=20 > Test has to come before asm tests (so that we are sure to compile > for the right target). >=20 > But real problem is that -Wl,-EB has to be added to TARGET_LDFLAGS only= >=20 Yes, discovered it already and updated the patch > [ 106s] configure:24950: clang -c -v -Wall -W -Wshadow > -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-decla= rations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extr= a-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-decl= aration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute= -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign= -compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-functio= n -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Ww= rite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -W= missing-prototypes -Wmissing-declarations -Wcast-align -Wextra -Wattribu= tes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmiss= ing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -= Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign= -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wfor= mat=3D2 -target powerpc -Wl,-EB -m32 -msoft-float -W error -Wall -W -DGRUB_MACHINE_IEEE1275=3D1 -DGRUB_MACHINE=3DPOWERPC_IEE= E1275 conftest.c >&5 [ 106s] clang version 3.6.1 (tags/RELEASE_361/final= 238133) > [ 106s] Target: powerpc > [ 106s] Thread model: posix > [ 106s] clang-3.6: error: -Wl,-EB: 'linker' input unused >=20 >=20 >>> So I'd rather try to produce patch for proper support of >>> -mbig-endian/-mlittle-endian (including passing it onto gcc linker) a= nd >>> until then declared clang on ppc64le having limited support (i.e. >>> support for automatic detection by configure). >>> >> I agree that this is a better approach in long term. But if we can get= >> some support for current tools with little work (see patch) and withou= t >> risks of breaking other tools I see no reason not to go for it in shor= t term >>> >> >=20 --------------050505020508080502010807 Content-Type: text/x-diff; name="be.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="be.diff" diff --git a/configure.ac b/configure.ac index fd8a62e..e54b9df 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,7 @@ if test "x$with_platform" =3D x; then x86_64-*) platform=3Dpc ;; powerpc-*) platform=3Dieee1275 ;; powerpc64-*) platform=3Dieee1275 ;; + powerpc64le-*) platform=3Dieee1275 ;; sparc64-*) platform=3Dieee1275 ;; mipsel-*) platform=3Dloongson ;; mips-*) platform=3Darc ;; @@ -138,6 +139,7 @@ case "$target_cpu"-"$platform" in x86_64-none) ;; x86_64-*) target_cpu=3Di386 ;; powerpc64-ieee1275) target_cpu=3Dpowerpc ;; + powerpc64le-ieee1275) target_cpu=3Dpowerpc ;; esac =20 # Check if the platform is supported, make final adjustments. @@ -560,6 +562,41 @@ AC_COMPILE_IFELSE( ]])], [grub_cv_cc_target_clang=3Dno], [grub_cv_cc_target_clang=3Dyes])]) =20 +if test x$target_cpu =3D xpowerpc; then + AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_ta= rget_cc_big_endian, [ + grub_cv_target_cc_big_endian=3Dno + for cand in "-target powerpc -Wl,-EB" "-target powerpc" \ + "-target powerpc-linux-gnu -Wl,-EB" "-target powerpc-linux-gnu" \ + "-mbig-endian"; do + if test x"$grub_cv_target_cc_big_endian" !=3D xno ; then + break + fi + CFLAGS=3D"$TARGET_CFLAGS $cand -Werror" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER= _BIG_ENDIAN__ !=3D __BYTE_ORDER__) +#error still little endian +#endif +asm (".globl start; start:"); +void __main (void); +void __main (void) {} +int main (void); +]], [[]])], + [grub_cv_target_cc_big_endian=3D"$cand"], []) + done + ]) + + if test x"$grub_cv_target_cc_big_endian" =3D xno ; then + AC_MSG_ERROR([could not force big-endian]) + fi + + skip_linkflags=3D"$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-E= B@@')" + + TARGET_CFLAGS=3D"$TARGET_CFLAGS $skip_linkflags" + TARGET_CPPFLAGS=3D"$TARGET_CPPFLAGS $skip_linkflags" + TARGET_CCASFLAGS=3D"$TARGET_CCASFLAGS $skip_linkflags" + TARGET_LDFLAGS=3D"$TARGET_LDFLAGS $grub_cv_target_cc_big_endian" +fi + AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm= _compile], [ test_program=3D case "x$target_cpu-$platform" in --------------050505020508080502010807-- --s7l7maKhTtlmBDXrBQFJp0N7eWDJxgGa1 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 iF4EAREKAAYFAlWoAGMACgkQmBXlbbo5nOtetQEApRObqgWqSIAp/1YdjXf8AzQN YKKcjiGrT35ahH40QzIA/jnQz8g5UGHdPYUm27ace6poof/CxnyTv7S9fdt2S7l5 =RL+P -----END PGP SIGNATURE----- --s7l7maKhTtlmBDXrBQFJp0N7eWDJxgGa1--