grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] Add powerpc little-endian (ppc64le) flags


From: Andrei Borzenkov
Subject: Re: [PATCH 1/2] Add powerpc little-endian (ppc64le) flags
Date: Sun, 5 Jul 2015 20:38:39 +0300

В Sat, 4 Jul 2015 09:46:59 +0300
Andrei Borzenkov <address@hidden> пишет:

> В Tue, 30 Jun 2015 21:34:10 +0200
> "Vladimir 'phcoder' Serbinenko" <address@hidden> пишет:
> 
> > I think those flags disable only runtime libraries, not the code generation
> 
> 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" <address@hidden> a écrit :
> > 
> > > В Tue, 30 Jun 2015 15:05:46 -0300
> > > Paulo Flabiano Smorigo <address@hidden> пишет:
> > >
> > > > 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 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=powerpc64le -mbig-endian -m32 produces code for PPC32
> BE, so just works:
> 
> address@hidden:~/build/clang-ppc/bin> ./clang  --target=powerpc64le   -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.
> address@hidden:~/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=powerpc
> > >
> > > 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=--target=powerpc
> 
> 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=powerpc -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).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]