From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZBHEE-0007Oo-L9 for mharc-grub-devel@gnu.org; Sat, 04 Jul 2015 02:47:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBHEB-0007OV-Py for grub-devel@gnu.org; Sat, 04 Jul 2015 02:47:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBHE6-0003gB-Qj for grub-devel@gnu.org; Sat, 04 Jul 2015 02:47:07 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:34297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBHE6-0003fs-D2 for grub-devel@gnu.org; Sat, 04 Jul 2015 02:47:02 -0400 Received: by lagx9 with SMTP id x9so104350985lag.1 for ; Fri, 03 Jul 2015 23:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=745zIed8kC2QcxGJalNStXxn5gezhYytpfyaBwmFMkE=; b=cshDwWDKrpk090auVIxvzPlYqUJbt4YWY7+UPSanez7mA2zPNC6Ebmu6gS/O8VtIAA bHrKozG9NAegAhTPjpx+lzRBkudP2wrY3LVoUM0qibhzGPLFM8uno7vtRHZFpiDtVOrj CYDXH98BQompxDBMYjPnd5qGdV4Nqbzxlmu1XDy81uZm2btAXmbmf5VoSAGcJBKI05iV GNnH56hA6IFIiqNrXTJsTwPwkKlXFlfXfXLa24FHGmM4+axaqZ9ucej+6WWBrBf/PCqO 7k4kindyQXi97/cWdnFzB9zEsSHet8bN82aPwSkQujY/kRLAMzWm5M7UQ3QbrfVgO/ID SpBw== X-Received: by 10.112.105.104 with SMTP id gl8mr39464008lbb.81.1435992421078; Fri, 03 Jul 2015 23:47:01 -0700 (PDT) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id w10sm2879862laz.6.2015.07.03.23.46.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jul 2015 23:47:00 -0700 (PDT) Date: Sat, 4 Jul 2015 09:46:59 +0300 From: Andrei Borzenkov To: "Vladimir 'phcoder' Serbinenko" Subject: Re: [PATCH 1/2] Add powerpc little-endian (ppc64le) flags Message-ID: <20150704094659.6aa48bf5@opensuse.site> In-Reply-To: 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> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/bOajwDieeDdZblOvjh.jNzd" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22d 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: Sat, 04 Jul 2015 06:47:09 -0000 --MP_/bOajwDieeDdZblOvjh.jNzd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =D0=92 Tue, 30 Jun 2015 21:34:10 +0200 "Vladimir 'phcoder' Serbinenko" =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: > I think those flags disable only runtime libraries, not the code generati= on Yes, you are right. Clang seems to be built for the whole family, i.e. PowerPC, which seems to automatically include all three versions (ppc, ppc64, ppc64le) See below for details. > Le 30 juin 2015 20:29, "Andrei Borzenkov" a =C3=A9c= rit : >=20 > > =D0=92 Tue, 30 Jun 2015 15:05:46 -0300 > > Paulo Flabiano Smorigo =D0=BF=D0=B8=D1= =88=D0=B5=D1=82: > > > > > On 2015-06-30 11:33, Vladimir 'phcoder' Serbinenko wrote: > > > > What about clang? > > > > > > Not good news about clang support. This is what the toolchain team sa= id > > > about it: > > > > > > The -mbig-endian option was added around April 10th, 2014. > > > Unfortunately, those who implemented it only implemented it for ARM a= nd > > > one other architecture. > > > > > > The option is currently accepted on Power systems, but does not have = any > > > affect on the code generation for Power. > > > Support for it looks rather trivial; see attached patch. Anyone has good connection to clang development community? Using this patch the clang --target=3Dpowerpc64le -mbig-endian -m32 produces code for PPC32 BE, so just works: bor@opensuse:~/build/clang-ppc/bin> ./clang --target=3Dpowerpc64le -c -m= big-endian -m32 /tmp/foo.c /tmp/foo.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] foo() ^ 1 warning generated. bor@opensuse:~/build/clang-ppc/bin> file foo.o foo.o: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV),= not stripped The problem is that in this case we do not really have any way to test if it works in configure, so no way to fail gracefully. > > > > > > So, what can we do here? Maybe add a constrain in the configure file > > > saying that it's not possible to build GRUB in a LE environment using > > clang. > > > > If I understand it correctly, it is possible to build for big-endian > > PowerPC using > > > > clang -target=3Dpowerpc > > > > but then we depend on clang being built with BE target support; and > > e.g. openSUSE builds it with > > Yes, that works too. But I'm not sure how we can test for it. Brute force would of course be $TARGET_CC --version | grep clang && TARGET_CFLAGS=3D--target=3Dpowerpc Comments? I'm inclined to use this workaround. This still may have issues when using external assembler, but here we can simply mandate support for clang 3.6 at the minimum, which should use integrated assembler on PPC by default. --MP_/bOajwDieeDdZblOvjh.jNzd Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=clang-ppc-endian-switch.patch From: Andrei Borzenkov Subject: [PATCH] support -big-endian/-mlittle-endian on PowerPC64 Signed-off-by: Andrei Borzenkov --- lib/Driver/Driver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d4b47a4..b7a6a66 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1947,6 +1947,8 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple, Target.setArch(llvm::Triple::mips64el); else if (Target.getArch() == llvm::Triple::aarch64_be) Target.setArch(llvm::Triple::aarch64); + else if (Target.getArch() == llvm::Triple::ppc64) + Target.setArch(llvm::Triple::ppc64le); } else { if (Target.getArch() == llvm::Triple::mipsel) Target.setArch(llvm::Triple::mips); @@ -1954,6 +1956,8 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple, Target.setArch(llvm::Triple::mips64); else if (Target.getArch() == llvm::Triple::aarch64) Target.setArch(llvm::Triple::aarch64_be); + else if (Target.getArch() == llvm::Triple::ppc64le) + Target.setArch(llvm::Triple::ppc64); } } -- tg: (76af433..) e/ppc-mendian (depends on: master) --MP_/bOajwDieeDdZblOvjh.jNzd--