Big-endian in combined one-pass build

Jeff Johnston jjohnstn@redhat.com
Mon Jan 24 22:37:00 GMT 2011


On 01/24/2011 09:52 AM, Drasko DRASKOVIC wrote:
> Hi all,
> I am trying to compile GCC 4.5.1 and newlib-1.18.0 in one-pass
> combined build. I created symlink to newlib directory in gcc
> directory. Target is arm-elf.
>
> I use configuration options --disable-multilib and --with-endian=big.
>
> After compilation of toolchain, I can see that Newlib was compiled in
> LE mode, so I can not compile my software properly.
>
> I noticed that in order to compile newlib in BE mode, I have to force
> GCC target to armeb-elf (and then newlib have to be patched, because
> it does not recognize armeb target)
>
> Questions are :
> 1) Why is this happening and how to force newlib to compile in BE mode ?

Normally, newlib is built with a target and using multilib.  Gcc then 
reports the permutations to build newlib with.  When you don't use 
multilib, then newlib gets built with the default options and whatever 
options you override.  If the default for arm-elf is to be LE, then 
that's what you end up with.

No one has ever requested or added armeb-elf as a newlib target.

> 2) Can --with-endian=big flag work even if I disabled multilib (i.e.
> is multilib necessary for BE mode build ?)

By your test results, the with-endian flag is not being used to set 
compilation flags passed to newlib.  Newlib doesn't interpret or do 
anything with the --with-endian setting.

> 3) Do I always have to use armeb-elf instead of arm-elf target when
> multilib is disabled

If you don't override the compilation flags manually, then yes.

> 4) Do I have to use make CFLAGS_FOR_TARGET="-mbig-endian -msoft-float"
> CCASFLAGS="-mbig-endian -msoft-float" when calling GCC (with newlib
> combined, one-pass) build to force Newlib to compile in big-endian
> mode ?
>

Actually, for newlib, use TARGET_CFLAGS="-mbig-endian -msoft-float". 
You might require the CFLAGS_FOR_TARGET to ensure that other target libs 
are built with the same options (e.g. libgcc).

-- Jeff J.



More information about the Newlib mailing list