"arm-linux-gnueabi-gcc-4.4 -march=armv4t" silently produces "armv7" (pkgversion=Ubuntu/Linaro 4.4.5-15ubuntu1)

Steffen Dettmer steffen.dettmer at googlemail.com
Tue Nov 8 09:41:52 UTC 2011


Hi,

I hope I ask on the right place, otherwise a redirection is appreciated.
I write here because "dpkg-query -p gcc-4.4-arm-linux-gnueabi" tells:
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss at lists.ubuntu.com>.
On debian-arm mailinglist I learnt it could be a ubuntu-specific
problem with the compiler package, because arm-linux-gnueabi-gcc-4.4
(gcc-4.4 4.4.6-11) seems to work correctly.

I have to put two excuses at the begin: first, I'm not a Debian
or Ubuntu user and not familiar with the dpkg and apt-get
details; second, I also don't have much knowledge about
ARM-linux. But I'm learning.

I installed 6.0.1 (according to /etc/debian_version) on an ARM board
with v5TE architecture which is not able to execute armv7 code.
Precompiled binaries are v4T. Now I tried to install gcc toolchain to
build my application. On a "squeeze/sid" (according to
/etc/debian_version) intel machine I used synaptic to install packages
with "arm", "gnueabi" and "armel" based on guessing inspired by
reading http://wiki.debian.org/ArmEabiPort. That documentation for me
unfortunately is insufficient.

I tried to compile with "arm-linux-gnueabi-gcc-4.4 -march=armv4t", but
I do not get "Tag_CPU_arch: v4T" (readelf -A) but "Tag_CPU_arch: v7".
It seems that the tool chain was built incorrectly and specific to
armv7; I don't find the multi-libs -- there seems to be only one
single set of libs (libgcc.a etc)! I had expected one set for each
combination of compiler flags (hardfloat/softfloat, arm/thumb, ....),
so heaps of libs. I need something in between v4T, thumb, soft-float
to maybe v5T, armmode, soft-float, interwork.

I considered to rebuilt the packages
(gcc-4.4-arm-linux-gnueabi_4.4.5-15ubuntu1_i386.deb, others) but I
have no clue how to do so. The build system seems to be sophisticated.
I found some "--with-arch=armv7-a" or alike in some "rules" files, but
I have no clue what to change and in which way to get a correct
ARM-linux-EABI toolchain supporting v4T.

I read that v4T is supposed to be the minimal CPU requirement, but I
don't get it working.
Do I need to install extra packages? Or do I need to rebuild the toolchain?

Isn't it a bug that v4T is not supported anymore?
In ChangeLog I read:
   -- Matthias Klose <doko at ubuntu.com>  Wed, 04 Nov 2009 16:04:17 +0100
      gcc-4.4 (4.4.2-1ubuntu1) lucid; urgency=low
      * Build --with-arch=armv7-a --with-fpu=vfpv3-d16 on armel.

Is this related? How do I workaround?

I would like to read more about Debian-ARM-Linux, but what google
finds seems to be very limited. For example, I was unable to find
instructions how to bootstrap a compiler, how to build a distribution
using specific compiler flags or anything. Any pointers appreciated.

Any help or pointers appreciated!

oki,

Steffen



tech info:

$ arm-linux-gnueabi-gcc-4.4 -mcpu=arm9tdmi -march=armv4t -msoft-float
-mfloat-abi=soft -mthumb-interwork -v -O0 -Wall -o hello-arm hello.c
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.4.5-15ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix
--with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.5
--libdir=/usr/lib --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions
--with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16
--with-mode=thumb --disable-werror --enable-checking=release
--program-prefix=arm-linux-gnueabi-
--includedir=/usr/arm-linux-gnueabi/include --build=i686-linux-gnu
--host=i686-linux-gnu --target=arm-linux-gnueabi
--with-headers=/usr/arm-linux-gnueabi/include
--with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.5-15ubuntu1)
COLLECT_GCC_OPTIONS='-mcpu=arm9tdmi' '-march=armv4t' '-msoft-float'
'-mfloat-abi=soft' '-mthumb-interwork' '-v' '-O0' '-Wall' '-o'
'hello-arm' '-mfpu=vfpv3-d16' '-mthumb'
 /usr/lib/gcc/arm-linux-gnueabi/4.4.5/cc1 -quiet -v hello.c -quiet
-dumpbase hello.c -mcpu=arm9tdmi -march=armv4t -msoft-float
-mfloat-abi=soft -mthumb-interwork -mfpu=vfpv3-d16 -mthumb -auxbase
hello -O0 -Wall -version -o /tmp/ccYlVa85.s ignoring duplicate
directory "/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/arm-linux-gnueabi/4.4.5/include
 /usr/lib/gcc/arm-linux-gnueabi/4.4.5/include-fixed
 /usr/arm-linux-gnueabi/include
End of search list.
GNU C (Ubuntu/Linaro 4.4.5-15ubuntu1) version 4.4.5 (arm-linux-gnueabi)
       compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR
version 3.0.0-p8.
GGC heuristics: --param ggc-min-expand=100 --param
ggc-min-heapsize=131072 Compiler executable checksum:
42a829754c2f3234f27c5e633e6060a3 COLLECT_GCC_OPTIONS='-mcpu=arm9tdmi'
'-march=armv4t' '-msoft-float' '-mfloat-abi=soft' '-mthumb-interwork'
'-v' '-O0' '-Wall' '-o' 'hello-arm' '-mfpu=vfpv3-d16' '-mthumb'
 /usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/as
-mcpu=arm9tdmi -march=armv4t -mthumb-interwork -mfloat-abi=soft
-mfloat-abi=soft -mfpu=vfpv3-d16 -mimplicit-it=thumb -meabi=5 -o
/tmp/ccnGKguj.o /tmp/ccYlVa85.s
COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.5/:/usr/lib/gcc/arm-linux-gnueabi/4.4.5/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.5/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.5/:/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/lib/:/usr/lib/i386-linux-gnu/
COLLECT_GCC_OPTIONS='-mcpu=arm9tdmi' '-march=armv4t' '-msoft-float'
'-mfloat-abi=soft' '-mthumb-interwork' '-v' '-O0' '-Wall' '-o'
'hello-arm' '-mfpu=vfpv3-d16' '-mthumb'
 /usr/lib/gcc/arm-linux-gnueabi/4.4.5/collect2 --build-id
--eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X --hash-style=gnu
-m armelf_linux_eabi -o hello-arm
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/lib/crt1.o
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/lib/crti.o
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/crtbegin.o
-L/usr/lib/gcc/arm-linux-gnueabi/4.4.5
-L/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/lib
-L/usr/lib/i386-linux-gnu /tmp/ccnGKguj.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/crtend.o
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/lib/crtn.o

$ readelf -A hello-arm
Attribute Section: aeabi
File Attributes
 Tag_CPU_name: "7-A"
 Tag_CPU_arch: v7
 Tag_CPU_arch_profile: Application
 Tag_ARM_ISA_use: Yes
 Tag_THUMB_ISA_use: Thumb-2
 Tag_FP_arch: VFPv3-D16
 Tag_ABI_PCS_wchar_t: 4
 Tag_ABI_FP_denormal: Needed
 Tag_ABI_FP_exceptions: Needed
 Tag_ABI_FP_number_model: IEEE 754
 Tag_ABI_align_needed: 8-byte
 Tag_ABI_align_preserved: 8-byte, except leaf SP
 Tag_ABI_enum_size: int
 Tag_ABI_HardFP_use: SP and DP
 Tag_DIV_use: Not allowed

$ readelf -A /usr/arm-linux-gnueabi/lib/libc.so.6
Attribute Section: aeabi
File Attributes
 Tag_CPU_name: "7-A"
 Tag_CPU_arch: v7
...

$ readelf -A /usr/lib/gcc/arm-linux-gnueabi/4.4.5/libgcc.a
...
File: /usr/lib/gcc/arm-linux-gnueabi/4.4.5/libgcc.a(*.o)
Attribute Section: aeabi
File Attributes
 Tag_CPU_name: "7-A"
 Tag_CPU_arch: v7
...



>From a working binary:
Attribute Section: aeabi
File Attributes
 Tag_CPU_name: "ARM9TDMI"
 Tag_CPU_arch: v4T
 Tag_ARM_ISA_use: Yes
 Tag_THUMB_ISA_use: Thumb-1
 Tag_ABI_PCS_wchar_t: 4
 Tag_ABI_FP_denormal: Needed
 Tag_ABI_FP_exceptions: Needed
 Tag_ABI_FP_number_model: IEEE 754
 Tag_ABI_align_needed: 8-byte
 Tag_ABI_enum_size: int

which is what I expect to build, too.




More information about the Ubuntu-devel-discuss mailing list