public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* Need a cross compiler for very old PXA270-based system
@ 2012-04-17 14:07 Eric Doenges
  2012-04-17 19:07 ` Martin Guy
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Doenges @ 2012-04-17 14:07 UTC (permalink / raw)
  To: crossgcc

Hi,

I have the following problem - a customer wants us to port our software
to their existing embedded system, which uses an Intel PXA270 processor
and runs an ancient Linux (I think it's 2.6.16). The toolchain used for
this system is the 'arm-linux-toolchain-bin-12-15-04-driscoll.tar.gz'.
Unfortunately, a bug in gcc-3.4.3 prevents our software from compiling
correctly, so I need a newer version of gcc that uses the headers and
libraries from the existing toolchain. I also need a newer binutils that
will handle --gc-sections correctly.

My first attempt was to build gcc-4.3.7 and binutils-2.21.1. I
downloaded and unpacked the sources, added symlinks in the gcc source
directory to the binutils directory in order to be able to build
binutils and gcc together, and then used the following configure options:

../gcc-4.3.6/configure --target=arm-linux
--prefix=/home/doenges/opt/pxa270 --with-cpu=iwmmxt --with-arch=iwmmxt
--with-abi=iwmmxt --without-fp --with-float=soft
--enable-cxx-flags=-mcpu=iwmmxt
--with-sysroot=/proj/opt/arm-linux/arm-linux
--with-local-prefix=/proj/opt/arm-linux/arm-linux --disable-nls
--disable-libmudflap --disable-libssp --enable-threads=posix
--enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++
--enable-shared --enable-c99 --enable-long-long --disable-multilib

This fails during building of libgcc due to __DTORS_LIST__ not being
declared. If I change the --target to arm-iwmmxt-linux-gnueabi, it fails
while attempting to link libgcc because gcc will generate Version4 EABI
objects, while the linker expects the old (pre-EABI) ABI. If I leave out
the --with-abi=iwmmxt, it fails much sooner because gcc 4.3.6 refuses to
compile for iwmmxt when not using the new ABI.

Figuring the ABI problem is inherent to gcc 4.x, I then tried to compile
gcc-3.4.6 (again using binutils 2.21.1) using the following configure
options:

../gcc-3.4.6/configure --target=arm-linux
--prefix=/home/doenges/opt/pxa270 --with-cpu=iwmmxt --with-float=soft
--enable-cxx-flags=-mcpu=iwmmxt
--with-headers=/proj/opt/arm-linux/arm-linux/include
--with-local-prefix=/proj/opt/arm-linux/arm-linux --disable-nls
--enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
--without-fp

This also fails during linking of libgcc with the linker complaining
that the object files contain FPA instructions, while the link target
does not. Note that the object files don't actually contain any FPA
instructions; it seems the problem is that the flags in the ELF headers
don't match - objects generated by the compiler have (reported by
readelf -h)

Flags:  0x200, GNU EABI, software FP

while the libraries in the existing toolchain have

Flags:  0x602, has entry point, GNU EABI, software FP, VFP

I have no idea why readelf thinks these are GNU EABI files, as it
reports OS/ABI as 'ARM', with ABI version 0.

I then tried compiling gcc-3.4.3 using the same configure options as in
the original toolchain (obtained by running arm-linux-gcc -v):

../gcc-3.4.3/configure --target=arm-linux
--prefix=/home/doenges/opt/pxa270 --with-cpu=iwmmxt
--enable-cxx-flags=-mcpu=iwmmxt
--with-headers=/proj/opt/arm-linux/arm-linux/include
--with-local-prefix=/proj/opt/arm-linux/arm-linux --disable-nls
--enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
--without-fp

This fails with the same error(s) as gcc 3.4.3, though the object files
created by the compiler now have these flags:

Flags:  0x0

So, to finally get to the point - does anyone have any idea what I must
do to get a working gcc toolchain for the PXA270 using the old ABI ?

With kind regards,
Eric

P.S.: I apologize in advance if this is not the correct mailing list for
this question, but after a fruitless day of googling I'm fresh out of
ideas and don't really know where else to ask.
-- 
Dr. Eric Dönges                            doenges@mvtec.com
MVTec Software GmbH | Neherstr. 1 | 81675 München  | Germany
www.mvtec.com | Tel: +49 89 457695-0 | Fax: +49 89 457695-55
Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need a cross compiler for very old PXA270-based system
  2012-04-17 14:07 Need a cross compiler for very old PXA270-based system Eric Doenges
@ 2012-04-17 19:07 ` Martin Guy
  2012-04-18  8:42   ` Eric Doenges
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Guy @ 2012-04-17 19:07 UTC (permalink / raw)
  To: Eric Doenges; +Cc: crossgcc

On 17 April 2012 16:06, Eric Doenges <doenges@mvtec.com> wrote:
> I have the following problem - a customer wants us to port our software
> to their existing embedded system, which uses an Intel PXA270 processor
> and runs an ancient Linux (I think it's 2.6.16). The toolchain used for
> this system is the 'arm-linux-toolchain-bin-12-15-04-driscoll.tar.gz'.
> Unfortunately, a bug in gcc-3.4.3 prevents our software from compiling
> correctly, so I need a newer version of gcc that uses the headers and
> libraries from the existing toolchain.

The quickest way would be to install a prebuilt toolchain, unless you
are up for the challenge.

You'll find Debian packages of gcc 4.1, 4.2 and 4.3 arm-linux-gnu
cross toolchains under
http://www.emdebian.org/debian/pool/main/g/
Instructions for installing them are on that site's main page and will
work in Debian or Ubuntu systems.

They should be binary-compatible with your target. If you're not
familiar with Debian systems get back to me and I'll tell you the
mumble you need to chant at them to install them,

    M

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need a cross compiler for very old PXA270-based system
  2012-04-17 19:07 ` Martin Guy
@ 2012-04-18  8:42   ` Eric Doenges
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Doenges @ 2012-04-18  8:42 UTC (permalink / raw)
  To: Martin Guy; +Cc: crossgcc

On 17.04.2012 21:06, Martin Guy wrote:

> The quickest way would be to install a prebuilt toolchain, unless you
> are up for the challenge.

I had no idea building ARM toolchains would be such a pain. I don't
remember building Motorola 68k toolchains back in the late 90s being
anywhere near as complicated.

> 
> You'll find Debian packages of gcc 4.1, 4.2 and 4.3 arm-linux-gnu
> cross toolchains under
> http://www.emdebian.org/debian/pool/main/g/
> Instructions for installing them are on that site's main page and will
> work in Debian or Ubuntu systems.
> 
> They should be binary-compatible with your target. If you're not
> familiar with Debian systems get back to me and I'll tell you the
> mumble you need to chant at them to install them,

While using a pre-built toolchain sounds appealing, I don't think it
will work. According to the Debian documentation on the various ARM
ABIs, the old ABI will report the flags 0x0 with readelf -h; however,
the binaries/object files I have that run on this particular system
report 0x600 (which as far as I can tell means 'uses software floating
point using the VFP floating point format').

In the meantime, I've managed to compile gcc-3.4.6 by disabling c++
support (which I don't really need) and editing the spec file.
Unfortunately, this still didn't work because the linker now complains
about libfloat being missing. More googling leads me to believe my
problem was that the required floating point support is not compiled
into libgcc when configuring with --with-float=soft (and ld attempts to
link against the non-existant libfloat), but if this option is left out,
the object files are flagged as using hardware floating point. It also
seems I'm not the only person to run into this problem, and both
crosstool and crosstool-ng have patches. I applied the crosstool-ng
patch ('260-arm-softfloat.patch', with some modifications, as
crosstool-ng also applies other patches that I don't), used the
configure options of the original toolchain, and voila - it works ! The
compiler bug that caused me to go to all this trouble also seems to be gone.

With kind regards,
Eric
-- 
Dr. Eric Dönges                            doenges@mvtec.com
MVTec Software GmbH | Neherstr. 1 | 81675 München  | Germany
www.mvtec.com | Tel: +49 89 457695-0 | Fax: +49 89 457695-55
Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-18  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17 14:07 Need a cross compiler for very old PXA270-based system Eric Doenges
2012-04-17 19:07 ` Martin Guy
2012-04-18  8:42   ` Eric Doenges

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).