gcc and armhf binaries

3 posts
by Vanfanel » Tue Dec 11, 2012 2:44 pm
Hi there,

Sorry for the newbie question but, would g++ produce arm-hardfloat binaries automatically in latest debian wheezy if I don't specify any compiler options? (no "-march=armv6 -mfpu=vfp -mfloat-abi=hard" or anything).

g++ -v seems to suggest it's configured with these options:
Code: Select all
pi@raspberrypi ~/nx $ g++ -v
Using built-in specs.
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-12+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-12+rpi1)

...but I don't know if these are the options the compiler was compiled with, or the options that will be used when compiling new binaries without need of specifying them, or both.

Running "readelf -A" on a binary I compiled on raspbian wheezy with g++ without any of these options gives this result:
Code: Select all
pi@raspberrypi ~/nx $ readelf -A nx
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "6"
  Tag_CPU_arch: v6
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_FP_arch: VFPv2
  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_ABI_VFP_args: VFP registers
  Tag_DIV_use: Not allowed

...wich seems to suggest this binary is a hardfloar one and it's using the FPU on the SOC.
Am I right on this?
Posts: 400
Joined: Sat Aug 18, 2012 5:58 pm
by plugwash » Wed Dec 12, 2012 3:20 am
Yes gcc and g++ on raspbian will by default produce binaries that are correct for raspbian.
Forum Moderator
Forum Moderator
Posts: 3211
Joined: Wed Dec 28, 2011 11:45 pm
by Vanfanel » Wed Dec 12, 2012 4:54 pm
Thanks, plugwash :)
Posts: 400
Joined: Sat Aug 18, 2012 5:58 pm