From patchwork Thu Apr 26 23:27:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Hope X-Patchwork-Id: 155342 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 1ACB1B6F9F for ; Fri, 27 Apr 2012 09:28:01 +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=1336087682; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:In-Reply-To:References:From:Date: Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=HDf4Cjky52hyS9QQE3QC SUdI41U=; b=d5k55a2nGJ3SY04lBMiJMphOUhCyLWdsSkvixsCyk1y8Jsea+lY/ beUZYbCyCnO7sgTqyxuD6h5zWV47ULd1rBrp7PL0Q1JhGKdmHQMgeO6OcHJld9Km o9JTNyXnTnvziROPWuMZwtFVIekiF/RgUmzQ9cBCtjo1oZKv7dzwvUU= 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:X-Google-DKIM-Signature:Received:MIME-Version:Received:In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=cRCYehxPoyixeM9fjdA9nyRrf8pZlk/KEwNEEdyRmIm4z4FcHcU9l9NJBOTMmm EIDaXdLLr9TrBQPEt0vVxDqj65d7SSjhWFZLFQtvFEriHCCDkKB/iCQNC47NYCDd SUuDrrkhwsR7sNP5jQGbxv4Fzkso8aahwnzqxlPONYRPk=; Received: (qmail 6212 invoked by alias); 26 Apr 2012 23:27:55 -0000 Received: (qmail 6193 invoked by uid 22791); 26 Apr 2012 23:27:54 -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-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Apr 2012 23:27:40 +0000 Received: by wera1 with SMTP id a1so101917wer.20 for ; Thu, 26 Apr 2012 16:27:38 -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=NFyEk5hZ2shadAXc9gdFJRoJDsQsHvFAlJWOtp6lMgE=; b=XLf5+1GB9wTydbAvVfek2OEbmMK14ued1qRlRdPrv4zBbHEFPUxHmx7DX8KcKzu7JJ 4dUvqTX6jpFLD/asEfpHJNOMYO+cz+ZzalOLXtN/V4vnxM3nypp69ZlcmrorNYsauKLZ K9zdiXMih8muwulL9mIqRSJ/vfTFVhzQP9MuNQa5ulTakpJuE+dJm2M4zBljCnROAbws Pv23wQViLjWve4IJf1MswgIvsCnh7NygqcHH3InGcoxCPcOuKIf24awCc4+AgFBnjUcn bFR2SY5ch7DqKLRvQtj3+hTBnpzQpTl0dig3F0w74H7odB/OZy4Id8dGDTvyh3zYApIP c77A== Received: by 10.180.78.9 with SMTP id x9mr336363wiw.18.1335482858726; Thu, 26 Apr 2012 16:27:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.48.135 with HTTP; Thu, 26 Apr 2012 16:27:18 -0700 (PDT) In-Reply-To: References: <4F9576DE.9070608@arm.com> From: Michael Hope Date: Fri, 27 Apr 2012 11:27:18 +1200 Message-ID: Subject: Re: [PATCH v2] ARM: Use different linker path for hardfloat ABI To: "Carlos O'Donell" Cc: Richard Earnshaw , GCC Patches , "cross-distro@lists.linaro.org" , "libc-ports@sourceware.org" X-Gm-Message-State: ALoCoQltiKrBstoH5gTHYYOByyWAn1oHhKJAbUoULG9CjWmHiJVjgZxlxdkheq5VZ/udVFBnTQYT 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 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. diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index 2ace6f0..e3cba57 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -60,19 +60,17 @@ #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 binaries on an EABI system. + Use ld-linux-armhf.so.3 so that it will be possible to install both + hard and soft float binaries on a system. */ #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 +/* Update this rule if TARGET_DEFAULT_FLOAT_ABI changes from + ARM_FLOAT_ABI_SOFT. */ #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 "}" + "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT \ + "; :" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "}" /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to use the GNU/Linux version, not the generic BPABI version. */