busybox编译成arm平台的二进制文件时,需要注意编译器选项。推荐使用codesourcery提供的交叉编译器,它默认提供的-march参数是 armv5te. 而Ubuntu软件包中的交叉编译器默认的march参数是armv7-a.
具体的参数区别如下:
codesourcery:
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with:
/scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure
--build=i686-pc-linux-gnu
--host=i686-pc-linux-gnu
--target=arm-none-linux-gnueabi
--enable-threads
--disable-libmudflap
--disable-libssp
--disable-libstdcxx-pch
--enable-extra-sgxxlite-multilibs
--with-arch=armv5te
--with-gnu-as
--with-gnu-ld
--with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}'
--enable-languages=c,c++
--enable-shared
--disable-lto
--enable-symvers=gnu
--enable-__cxa_atexit
--with-pkgversion='Sourcery G++ Lite 2009q3-67'
--with-bugurl=https://support.codesourcery.com/GNUToolchain/
--disable-nls
--prefix=/opt/codesourcery
--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
--with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc
--with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--disable-libgomp
--enable-poison-system-directories
--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/cc1
-quiet
-v
-iprefix
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/ -isysroot /opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc
aa.c
-quiet
-dumpbase
aa.c
-march=armv5te
-auxbase
aa
-version
-funwind-tables
-o /tmp/cc1pXwY1.s
#include "..." search starts here:
#include <...> search starts here:
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include-fixed
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/include
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/include
GNU C (Sourcery G++ Lite 2009q3-67) version 4.4.1 (arm-none-linux-gnueabi)
compiled by GNU C version 4.3.2, GMP version 4.3.1, MPFR version 2.4.1-p5.
GGC heuristics:
--param
ggc-min-expand=100
--param
ggc-min-heapsize=131072
Compiler executable checksum: 74011fea7f66b1cda6b19363b6694363
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/as
-v
-march=armv5te
-meabi=5
-o
/tmp/cc4FZC9V.o
/tmp/cc1pXwY1.s
GNU assembler version 2.19.51 (arm-none-linux-gnueabi) using BFD version (Sourcery G++ Lite 2009q3-67) 2.19.51.20090709
COMPILER_PATH=/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/:/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/:/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/
LIBRARY_PATH=/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/:/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/:/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib/:/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/collect2
--sysroot=/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc
--eh-frame-hdr
-dynamic-linker
/lib/ld-linux.so.3
-X
-m
armelf_linux_eabi
-o
aa
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crt1.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crti.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/crtbegin.o
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc -L/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib /tmp/cc4FZC9V.o
-lgcc
--as-needed
-lgcc_s
--no-as-needed
-lc
-lgcc
--as-needed
-lgcc_s
--no-as-needed
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/crtend.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crtn.o
ubuntu cross compiler:
使用内建 specs。
目标:arm-linux-gnueabi
配置为:
../src/configure
-v
--with-pkgversion='Ubuntu/Linaro 4.4.7-1ubuntu2'
--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-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.7
--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
线程模型:posix
gcc 版本 4.4.7 (Ubuntu/Linaro 4.4.7-1ubuntu2)
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv7-a'
'-mfloat-abi=softfp'
'-mfpu=vfpv3-d16'
'-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/cc1
-quiet
-v
-imultilib
.
-imultiarch
arm-linux-gnueabi
aa.c
-quiet
-dumpbase
aa.c
-march=armv7-a
-mfloat-abi=softfp
-mfpu=vfpv3-d16
-mthumb
-auxbase
aa
-version
-o
/tmp/ccY8tups.s
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/include
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/include-fixed
/usr/arm-linux-gnueabi/include
GNU C (Ubuntu/Linaro 4.4.7-1ubuntu2) 版本 4.4.7 (arm-linux-gnueabi)
由 GNU C 版本 4.6.3 编译, GMP 版本 5.0.2,MPFR 版本 3.1.0-p3。
GGC 准则:--param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 602bbdb1e12aee29c89a048836b7c94c
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv7-a'
'-mfloat-abi=softfp'
'-mfpu=vfpv3-d16' '-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/bin/as
-march=armv7-a
-mfloat-abi=softfp
-mfpu=vfpv3-d16
-mimplicit-it=thumb
-meabi=5
-o
/tmp/ccSERt9Z.o
/tmp/ccY8tups.s
COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.7/:/usr/lib/gcc/arm-linux-gnueabi/4.4.7/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.7/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.7/:/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/lib/
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv7-a'
'-mfloat-abi=softfp'
'-mfpu=vfpv3-d16'
'-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/collect2
--build-id
--eh-frame-hdr
-dynamic-linker
/lib/ld-linux.so.3
-X
--hash-style=gnu
-m
armelf_linux_eabi
-o
aa
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/lib/crt1.o /usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/lib/crti.o
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/crtbegin.o
-L
/usr/lib/gcc/arm-linux-gnueabi/4.4.7
-L
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/lib /tmp/ccSERt9Z.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.7/crtend.o
/usr/lib/gcc/arm-linux-gnueabi/4.4.7/../../../../arm-linux-gnueabi/lib/crtn.o