From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22505 invoked by alias); 30 Apr 2012 21:48:33 -0000 Received: (qmail 22486 invoked by uid 22791); 30 Apr 2012 21:48:31 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f169.google.com (HELO mail-we0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Apr 2012 21:48:12 +0000 Received: by werj55 with SMTP id j55so2758428wer.0 for ; Mon, 30 Apr 2012 14:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding:x-gm-message-state; bh=fFsy6XE+y2bYhQzdL4/eNSfY4J1wBYIVdHGa3Rvzgxo=; b=oAJBL9YTFSLexf8tLYffp5wr5olJ5n5OSYo0Jv6nccyIRs+JudljGtqrT+8WCD287N QSkA2AnaacKgArVdnqoiRFySmvlZRWcAZn7IL1eUpXwK+psaGhNVhVtG82K9DhQDYmyn RZ4wIcrTWe9BabtHEdi6L3hwmHuFTtU9Bn1qaoOO44vIWdz6V2/73Xv4eVECrcwwg+1A ecuJgN0jmPmqaOdU0xc5ijXhPusZ940iUCkkFhCfbO8T0KYAzw19NvNSkVILshwPH/U0 ATo0vLzvYy1s/Elvu0n8rbSSRLjFuuRUvumFUgm9pUiJN910EY3ZbwHH6+8Puxw/Looi F7Xw== Received: by 10.180.90.233 with SMTP id bz9mr32094766wib.21.1335822491089; Mon, 30 Apr 2012 14:48:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.48.135 with HTTP; Mon, 30 Apr 2012 14:47:50 -0700 (PDT) In-Reply-To: <4F9EAE9D.3040509@arm.com> References: <4F9576DE.9070608@arm.com> <4F9EAE9D.3040509@arm.com> From: Michael Hope Date: Mon, 30 Apr 2012 21:48:00 -0000 Message-ID: Subject: Re: [PATCH v2] ARM: Use different linker path for hardfloat ABI To: Richard Earnshaw Cc: "Carlos O'Donell" , GCC Patches , "cross-distro@lists.linaro.org" , "libc-ports@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkh+UUhsnA/9E0S7SfXk2bryAk/cRJnr7fl5EhLPpcauwS0wIY4Xpo6bd+/BU0dUvGXziJx X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00209.txt.bz2 On 1 May 2012 03:24, Richard Earnshaw wrote: > 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 =A0Michael Hope =A0 >>>> =A0 =A0 =A0 =A0 =A0 =A0Richard Earnshaw =A0 >>>> >>>> =A0 =A0 =A0 =A0* config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_SOFT_FL= OAT): Define. >>>> =A0 =A0 =A0 =A0(GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define. >>>> =A0 =A0 =A0 =A0(GLIBC_DYNAMIC_LINKER_DEFAULT): Define. >>>> =A0 =A0 =A0 =A0(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 @@ >>>> =A0/* Use ld-linux.so.3 so that it will be possible to run "classic" >>>> =A0 =A0GNU/Linux binaries on an EABI system. =A0*/ >>>> =A0#undef =A0GLIBC_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 =3D=3D 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 \ >>>> + =A0 "%{mfloat-abi=3Dhard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \ >>>> + =A0 =A0%{mfloat-abi=3Dsoft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ >>>> + =A0 =A0%{!mfloat-abi=3D*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" >>>> >>>> =A0/* At this point, bpabi.h will have clobbered LINK_SPEC. =A0We want= to >>>> =A0 =A0use the GNU/Linux version, not the generic BPABI version. =A0*/ >>> >>> 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 =3D=3D ARM_FLOAT_ABI_HARD" >>> evaluates to "#if 0 =3D=3D 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 =3D 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: >> =A0* The -mfloat-abi=3D command line argument, else >> =A0* The --with-float=3D configure time argument, else >> =A0* TARGET_DEFAULT_FLOAT_ABI from linux-eabi.h >> >> In the first case the ABI is explicit. =A0In the second >> OPTION_DEFAULT_SPECS turns the configure time argument into an explict >> -mfloat-abi=3D. >> >> 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=3Dsoftfp, >> --with-float=3Dhard, and then running with all combinations of >> {,-mfloat-abi=3Dsoftfp,-mfloat-abi=3Dhard} {,-mglibc,-muclibc,-mbionic}. >> >> OK? >> >> -- Michael >> >> 2012-04-27 =A0Michael Hope =A0 >> >> =A0 =A0 =A0 * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER): Pick the l= oader >> =A0 =A0 =A0 using a spec rule. >> > > Michael, > > can you try this patch please. =A0It 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. Hi Richard. Your patch tests just fine. I like it. You could change the spec rule to the newer if-elseif-else form but that's a nit. -- Michael