Date: Thu, 24 Sep 2015 15:58:12 -0600 From: Ian Lepore <ian@freebsd.org> To: Olavi Kumpulainen <olavi.m.kumpulainen@gmail.com> Cc: freebsd-arm@freebsd.org Subject: Re: gcc-4.2.1 on armv6 and Tag_ABI_HardFP_use Message-ID: <1443131892.1224.312.camel@freebsd.org> In-Reply-To: <64C9409F-7E9D-4CF2-90E1-3834908BC813@gmail.com> References: <64C9409F-7E9D-4CF2-90E1-3834908BC813@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2015-09-24 at 23:24 +0200, Olavi Kumpulainen wrote: > Hi everyone, > > I have a question regarding armv6 gcc-4.2.1 and Tag_ABI_HardFP_use in the generated ELF objects. > > I have a small c-program that looks as; > > #include <stdio.h> > > double fn(double x, double y) > { > return x+y; > } > > int main(int argc, char *argv[]) > { > printf("%f\n", fn(3.2, 9.7)); > return 0; > } > > > Compiling this with clang 3.4.1 produces the following results; > > $ cc -v > FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 > Target: armv6--freebsd10.2-gnueabi > Thread model: posix > Selected GCC installation: > > $ cc -c t.c -march=armv6 -mfloat-abi=soft > $ readelf -a t.o|grep ABI > OS/ABI: UNIX - System V > ABI Version: 0 > Flags: 0x5000000, Version5 EABI > Tag_ABI_FP_denormal: Needed > Tag_ABI_FP_exceptions: Needed > Tag_ABI_FP_number_model: IEEE 754 > Tag_ABI_align8_needed: Yes > Tag_ABI_align8_preserved: Yes, except leaf SP > > $ cc -c t.c -march=armv6 -mfloat-abi=softfp > $ readelf -a t.o|grep ABI > OS/ABI: UNIX - System V > ABI Version: 0 > Flags: 0x5000000, Version5 EABI > Tag_ABI_FP_denormal: Needed > Tag_ABI_FP_exceptions: Needed > Tag_ABI_FP_number_model: IEEE 754 > Tag_ABI_align8_needed: Yes > Tag_ABI_align8_preserved: Yes, except leaf SP > > > Then, if I build a new world using the following src.conf: > > $ cat /etc/src.conf > WITH_GCC=yes > WITH_GNUCXX=yes > WITH_GCC_BOOTSTRAP=yes > WITHOUT_CLANG=yes > WITHOUT_CLANG_IS_CC=yes > WITHOUT_CLANG_BOOTSTRAP=yes > > And the usual; > make TARGET=arm TARGET_ARCH=armv6 buildworld > > and; > make TARGET=arm TARGET_ARCH=armv6 buildenv > > > # cc -v > Using built-in specs. > Target: armv6-undermydesk-freebsd > Configured with: FreeBSD/armv6 system compiler > Thread model: posix > gcc version 4.2.1 20070831 patched [FreeBSD] > > # cc -c t.c -march=armv6 -mfloat-abi=soft > # readelf -A t.o |grep ABI > OS/ABI: UNIX - System V > ABI Version: 0 > Flags: 0x4000000, Version4 EABI > 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_align8_needed: Yes > Tag_ABI_align8_preserved: Yes, except leaf SP > Tag_ABI_enum_size: int > Tag_ABI_optimization_goals: Aggressive Debug > > A few more arc-specific tags, but none that strikes me as odd. > > But what about -mfloat-abi=softfp? > > # cc -c t.c -march=armv6 -mfloat-abi=softfp > # readelf -a t.o |grep ABI > OS/ABI: UNIX - System V > ABI Version: 0 > Flags: 0x4000000, Version4 EABI > 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_align8_needed: Yes > Tag_ABI_align8_preserved: Yes, except leaf SP > Tag_ABI_enum_size: int > Tag_ABI_HardFP_use: SP and DP > Tag_ABI_optimization_goals: Aggressive Debug > > Are there any reasons for the appearance of the 'Tag_ABI_HardFP_use: SP and DP˙ here? > > > /O That "SP and DP" corresponds to a value of 0x03 in the tag, and that is now listed as a deprecated value which is a synonym for a tag value of zero (or no tag present at all). The only value these days that has any meaning for Tag_ABI_HardFP_use is 0x01 which would mean basically "use only single-precision". I think this old value still appears when using gcc 4.2 because our gcc tools are so old. If you use -mfloat-abi=softfp you get hardware floating point (in a form compatible with libraries and programs that are compiled as software-only). The performance difference between -mfloat-abi=softfp and -mfloat-abi=hard is small for most programs, but there is no real reason to use anything these days except armv6hf which is pure hardfloat. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1443131892.1224.312.camel>