From patchwork Mon Apr 30 15:24:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Earnshaw X-Patchwork-Id: 155906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 66D83B6FA1 for ; Tue, 1 May 2012 01:24:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336404289; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=IPlnFvCoOqpjxLrUX56uOZb/r8M=; b=eM2/U2PBBEuRNuB TzueGm2G9SQj/6BzX+I7OMmHqIv9cxLyJebJ7ZtpJSvEVvJaxdLHEMdzVM7Ps1in o36Y2X+Or4IMSgJBYwjc7ICQ4Di/TBz5xLWwleP33IMcqnAelFkSGRowuQccSMnD fZMRuaQE/iJ9RCwNH8Klm65I6cFk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:X-MC-Unique:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ODDkf+rIcG5I0GTx30zMdYl+Xh4VgReatpBMciH7Pis1/sMz0mf63SQYsy1QXe Nff2aYEDNd3+N/zcpTiA/zK+05s3rS7/QiVYKieslpZ1oNECiNen+oM29JSgd5Px xp7fvjE5EfgwZx11En4Qr2sTedb5B1yT7Kmi86ulN6wgY=; Received: (qmail 29877 invoked by alias); 30 Apr 2012 15:24:38 -0000 Received: (qmail 29857 invoked by uid 22791); 30 Apr 2012 15:24:35 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Apr 2012 15:24:22 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 30 Apr 2012 16:24:16 +0100 Received: from [10.1.69.67] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 30 Apr 2012 16:25:42 +0100 Message-ID: <4F9EAE9D.3040509@arm.com> Date: Mon, 30 Apr 2012 16:24:13 +0100 From: Richard Earnshaw User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Michael Hope CC: Carlos O'Donell , GCC Patches , "cross-distro@lists.linaro.org" , "libc-ports@sourceware.org" Subject: Re: [PATCH v2] ARM: Use different linker path for hardfloat ABI References: <4F9576DE.9070608@arm.com> In-Reply-To: X-MC-Unique: 112043016241600601 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 27/04/12 00:27, Michael Hope wrote: > On 27 April 2012 08:20, Carlos O'Donell wrote: >> On Mon, Apr 23, 2012 at 5:36 PM, Michael Hope wrote: >>> 2012-04-24 Michael Hope >>> Richard Earnshaw >>> >>> * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_SOFT_FLOAT): Define. >>> (GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define. >>> (GLIBC_DYNAMIC_LINKER_DEFAULT): Define. >>> (GLIBC_DYNAMIC_LINKER): Redefine to use the hard float path. >>> >>> diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h >>> index 80bd825..2ace6f0 100644 >>> --- a/gcc/config/arm/linux-eabi.h >>> +++ b/gcc/config/arm/linux-eabi.h >>> @@ -62,7 +62,17 @@ >>> /* Use ld-linux.so.3 so that it will be possible to run "classic" >>> GNU/Linux binaries on an EABI system. */ >>> #undef GLIBC_DYNAMIC_LINKER >>> -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3" >>> +#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3" >>> +#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3" >>> +#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_HARD >>> +#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT >>> +#else >>> +#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT >>> +#endif >>> +#define GLIBC_DYNAMIC_LINKER \ >>> + "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \ >>> + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ >>> + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" >>> >>> /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to >>> use the GNU/Linux version, not the generic BPABI version. */ >> >> This patch is broken. Please fix this. >> >> You can't use a named enumeration in cpp equality. >> >> The type ARM_FLOAT_ABI_HARD is a named enumeration and evaluates to 0 >> as an unknown identifier. >> >> Therefore "#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_HARD" >> evaluates to "#if 0 == 0" and is always true. >> >> Watch out that "#define ARM_FLOAT_ABI_HARD ARM_FLOAT_ABI_HARD" for >> such enums is not conforming C99/C11. >> >> I suggest you define the types as macros and then set the named enum >> to those values, then use the macros in the header equality checks. >> >> e.g. >> #define VAL1 0 then enum FOO { RVAL1 = VAL1, ... } >> >> Look at arm.h for the enum definition. > > I've looked further into this and I think the original pre-#if version > is correct. > > The float ABI comes from these places: > * The -mfloat-abi= command line argument, else > * The --with-float= configure time argument, else > * TARGET_DEFAULT_FLOAT_ABI from linux-eabi.h > > In the first case the ABI is explicit. In the second > OPTION_DEFAULT_SPECS turns the configure time argument into an explict > -mfloat-abi=. > > The patch below covers all cases, keeps the logic in the spec file, > and adds a comment linking the two #defines. > > Tested by building with no configure flags, --wtih-float=softfp, > --with-float=hard, and then running with all combinations of > {,-mfloat-abi=softfp,-mfloat-abi=hard} {,-mglibc,-muclibc,-mbionic}. > > OK? > > -- Michael > > 2012-04-27 Michael Hope > > * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER): Pick the loader > using a spec rule. > Michael, can you try this patch please. It should make it possible to then create linux-eabihf.h containing just #undef TARGET_DEFAULT_FLOAT_ABI #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD #undef GLIBC_DYNAMIC_LINKER_DEFAULT #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT Which is not quite as simple as leaving out the second re-define, but pretty close. R. --- linux-eabi.h (revision 186924) +++ linux-eabi.h (local) @@ -32,7 +32,8 @@ while (false) /* We default to a soft-float ABI so that binaries can run on all - target hardware. */ + target hardware. If you override this to use the hard-float ABI then + change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */ #undef TARGET_DEFAULT_FLOAT_ABI #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT @@ -59,16 +60,19 @@ #undef SUBTARGET_EXTRA_LINK_SPEC #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION -/* Use ld-linux.so.3 so that it will be possible to run "classic" - GNU/Linux binaries on an EABI system. */ +/* GNU/Linux on ARM currently supports three dynamic linkers: + - ld-linux.so.2 - for the legacy ABI + - ld-linux.so.3 - for the EABI-derived soft-float ABI + - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI. + All the dynamic linkers live in /lib. + We default to soft-float, but this can be overridden by changing both + GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */ + #undef GLIBC_DYNAMIC_LINKER #define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3" #define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3" -#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_HARD -#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT -#else #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT -#endif + #define GLIBC_DYNAMIC_LINKER \ "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \