From owner-freebsd-arm@freebsd.org Thu Sep 24 21:58:21 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E85D2A08B65 for ; Thu, 24 Sep 2015 21:58:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA9A11162 for ; Thu, 24 Sep 2015 21:58:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Thu, 24 Sep 2015 21:58:48 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t8OLwCKo004011; Thu, 24 Sep 2015 15:58:13 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1443131892.1224.312.camel@freebsd.org> Subject: Re: gcc-4.2.1 on armv6 and Tag_ABI_HardFP_use From: Ian Lepore To: Olavi Kumpulainen Cc: freebsd-arm@freebsd.org Date: Thu, 24 Sep 2015 15:58:12 -0600 In-Reply-To: <64C9409F-7E9D-4CF2-90E1-3834908BC813@gmail.com> References: <64C9409F-7E9D-4CF2-90E1-3834908BC813@gmail.com> Content-Type: text/plain; charset="iso-8859-13" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2015 21:58:21 -0000 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 > > 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