This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Crosstool] arm targeted toolchain produces unusable elf programs


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

First of all, I would like to thank Dan for its so useful crosstool.

I'm developing an embedded board which is based on Freescale iMX31, so a
very nice ARM1136 core. I've got a development board with this chip
which has Linux, and while our prototype is being built, I'm playing
with it.

I've used crosstool-0.42 to build a simple arm toolchain using my simple
script that I past here (just in case):

> #!/bin/sh
> set -ex
> TARBALLS_DIR=$HOME/downloads
> export TARBALLS_DIR
> mkdir -p TARBALLS_DIR
> 
> RESULT_TOP=/opt/crosstool
> export RESULT_TOP
> mkdir -p RESULT_TOP
> 
> GCC_LANGUAGES="c,c++"
> export GCC_LANGUAGES
> 
> KERNELCONFIG=$PWD/arm.config
> export KERNELCONFIG
> 
> TARGET=arm-linux
> export TARGET
> TARGET_CFLAGS="-O"
> export TARGET_CFLAGS
> 
> BINUTILS_DIR=binutils-2.15
> GCC_DIR=gcc-3.4.2
> GLIBC_DIR=glibc-2.3.3
> GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.3
> LINUX_DIR=linux-2.6.10
> export BINUTILS_DIR GCC_DIR GLIBC_DIR GLIBCTHREADS_FILENAME LINUX_DIR
> 
> eval sh all.sh --notest
> 
> echo Done.
> 

Now the whole toolchain generation is working nicely. However, whey I
try to run the sample files (arm-linux-hello and
arm-linux-hello-static), only the statically built one actually works.

Here is what I get when I try to run the one that should use shared
library (note that I'm using busybox, but it's the same if I run bash
for instance):

> root@(none) ~$ ./arm-linux-hello
> -sh: ./arm-linux-hello: not found
> root@(none) ~$ ldd ./arm-linux-hello
> eval: 1: ./arm-linux-hello: not found
> root@(none) ~$ readelf -h arm-linux-hello
> ELF Header:
>   Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
>   Class:                             ELF32
>   Data:                              2's complement, little endian
>   Version:                           1 (current)
>   OS/ABI:                            ARM
>   ABI Version:                       0
>   Type:                              EXEC (Executable file)
>   Machine:                           ARM
>   Version:                           0x1
>   Entry point address:               0x839c
>   Start of program headers:          52 (bytes into file)
>   Start of section headers:          3220 (bytes into file)
>   Flags:                             0x2, has entry point, GNU EABI
>   Size of this header:               52 (bytes)
>   Size of program headers:           32 (bytes)
>   Number of program headers:         6
>   Size of section headers:           40 (bytes)
>   Number of section headers:         31
>   Section header string table index: 28

And here are the results with a "built-in" elf file:

> root@(none) /bin$ awk
> BusyBox v1.01 (2006.04.28-08:15+0000) multi-call binary
> 
> Usage: awk [OPTION]... [program-text] [FILE ...]
> 
> Options:
>         -v var=val              assign value 'val' to variable 'var'
>         -F sep          use 'sep' as field separator
>         -f progname             read program source from file 'progname'
> 
> root@(none) /bin$ ldd awk
>         libm.so.6 => /lib/libm.so.6 (0x40020000)
>         libcrypt.so.1 => /lib/libcrypt.so.1 (0x40092000)
>         libc.so.6 => /lib/libc.so.6 (0x400c7000)
>         /lib/ld-linux.so.3 (0x40000000)
> root@(none) /bin$ ls -l /lib/libc.so.6
> lrwxrwxrwx    1 root     root           13 Jan  1 00:00 /lib/libc.so.6 -> libc-2.3.3.so
> root@(none) /bin$ readelf -h awk
> ELF Header:
>   Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
>   Class:                             ELF32
>   Data:                              2's complement, little endian
>   Version:                           1 (current)
>   OS/ABI:                            UNIX - System V
>   ABI Version:                       0
>   Type:                              EXEC (Executable file)
>   Machine:                           ARM
>   Version:                           0x1
>   Entry point address:               0xce18
>   Start of program headers:          52 (bytes into file)
>   Start of section headers:          581408 (bytes into file)
>   Flags:                             0x4000002, has entry point, <unrecognized EABI>
>   Size of this header:               52 (bytes)
>   Size of program headers:           32 (bytes)
>   Number of program headers:         9
>   Size of section headers:           40 (bytes)
>   Number of section headers:         29
>   Section header string table index: 28

So we can see that the glibc version is the one I chose in my crosstool
script ...

Someone has a clue what's the problem here or where I should try to find
a solution ?

Thank you very much!

Valentin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFExzj0CGmesagzEtoRAq89AKCSuGmJmT/aEzLiXnnLO79Wayg9LwCeNrVl
eJBlr4heYsmJhBZNeZ5UBPc=
=WKe+
-----END PGP SIGNATURE-----

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]