Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZBnsU-00041F-B6 for mharc-grub-devel@gnu.org; Sun, 05 Jul 2015 13:38:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBnsO-0003xf-8v for grub-devel@gnu.org; Sun, 05 Jul 2015 13:38:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBnsL-00030V-1k for grub-devel@gnu.org; Sun, 05 Jul 2015 13:38:48 -0400 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:36072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBnsK-000308-KV for grub-devel@gnu.org; Sun, 05 Jul 2015 13:38:44 -0400 Received: by lagc2 with SMTP id c2so130658165lag.3 for ; Sun, 05 Jul 2015 10:38:42 -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:content-transfer-encoding; bh=I2ksS2vRmGnK/ZfmqJa9CvNjTmOz45KKqeFvhjDFSAQ=; b=YU42474RPwTjw1TKbJ9qrJ8X4P1Axia9WtRw+3LPEOQh8SAA/thI6IrG0Ebg4myTrg Hry1y66roWGrkj0mgiN743ed7MBIcYNDAvkkYHay/xaR5luqTyRA8zONnIqOAY0fsEqw HGCD3ROPnhfSQlFkkqGmtDAKcRhFT3RjMfH/i3GREYODcxWLCqdlkF/YR7D7lto3XW9P ibyL6svlIxkyeuOPHFx4+7sTIknYIwAirOUssDZM0lP/D4VYo+7V+EjwFDTuvU52R1rS tp61MUYEFrTtw9yVqwkYTQN7jde4OPa/BKezb9+krH5RLTYf2QzUeiLnxDVjKjl/Iork alFQ== X-Received: by 10.152.120.135 with SMTP id lc7mr44275267lab.107.1436117922412; Sun, 05 Jul 2015 10:38:42 -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 q3sm3984807laa.30.2015.07.05.10.38.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2015 10:38:41 -0700 (PDT) Date: Sun, 5 Jul 2015 20:38:39 +0300 From: Andrei Borzenkov To: "Vladimir 'phcoder' Serbinenko" Subject: Re: [PATCH 1/2] Add powerpc little-endian (ppc64le) flags Message-ID: <20150705203839.124984af@opensuse.site> In-Reply-To: <20150704094659.6aa48bf5@opensuse.site> 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> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::235 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: Sun, 05 Jul 2015 17:38:49 -0000 =D0=92 Sat, 4 Jul 2015 09:46:59 +0300 Andrei Borzenkov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > =D0=92 Tue, 30 Jun 2015 21:34:10 +0200 > "Vladimir 'phcoder' Serbinenko" =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: >=20 > > I think those flags disable only runtime libraries, not the code genera= tion >=20 > 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) >=20 > See below for details. >=20 > > Le 30 juin 2015 20:29, "Andrei Borzenkov" a =C3= =A9crit : > >=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 = said > > > > about it: > > > > > > > > The -mbig-endian option was added around April 10th, 2014. > > > > Unfortunately, those who implemented it only implemented it for ARM= and > > > > one other architecture. > > > > > > > > The option is currently accepted on Power systems, but does not hav= e any > > > > affect on the code generation for Power. > > > > >=20 > Support for it looks rather trivial; see attached patch. Anyone has good > connection to clang development community? >=20 > Using this patch the >=20 > clang --target=3Dpowerpc64le -mbig-endian -m32 produces code for PPC32 > BE, so just works: >=20 > bor@opensuse:~/build/clang-ppc/bin> ./clang --target=3Dpowerpc64le -c = -mbig-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 >=20 > 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. >=20 > > > > > > > > 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 usi= ng > > > 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 > > > >=20 > Yes, that works too. But I'm not sure how we can test for it. Brute > force would of course be >=20 > $TARGET_CC --version | grep clang && TARGET_CFLAGS=3D--target=3Dpowerpc >=20 > 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. Unfortunately it fails to link. clang does not pass any explicit endian flag to linker; endianness is property of target and clang expects to have tool chain for each target. This is exactly what we want to avoid (we want to avoid having ppc32 toolchaing on ppc64le), so clang falls back to generic gcc as linker and it attempts to produce LE output from BE objects and fails. I thinks it is clang deficiency. It should pass endianness flags just as it does currently for -m32/-m64. It is possible to compile using "--target=3Dpowerpc -Wl,-EB" - this works on all three ppc, ppc64 and ppc64le, but this means hardcoding GNU ld dependency. So I'd rather try to produce patch for proper support of -mbig-endian/-mlittle-endian (including passing it onto gcc linker) and until then declared clang on ppc64le having limited support (i.e. support for automatic detection by configure).