This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ARM: Use different linker path for hardfloat ABI


On Tue, Apr 03, 2012 at 03:29:06PM +1200, Michael Hope wrote:
> On 3 April 2012 09:06, dann frazier <dann.frazier@canonical.com> wrote:
> > On Fri, Mar 30, 2012 at 06:52:34PM +0100, Richard Earnshaw wrote:
> >> On 29/03/12 20:34, dann frazier wrote:
> >> > This is an updated version of a patch Debian and Ubuntu are using to
> >> > use an alternate linker path for hardfloat binaries. The difference
> >> > with this one is that it covers the case where no float flag
> >> > was passed in, defaulting to the softfloat path.
> 
> Hi Dann.  The change should be in the EABI specific linux-eabi.h
> instead of the shared/OABI linux-elf.h.  It breaks support for uClibc
> and Bionic by always using the GLIBC loader in hard float mode.  The
> final line in the spec is missing a '=hard' and always adds
> /lib/ld-linux.so.3.
> 
> How about:
> 
> 2012-04-03  Michael Hope  <michael.hope@linaro.org>
> 
>        * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
>        (GLIBC_DYNAMIC_LINKER): Redefine to use the hard float loader.

Nice, thanks Michael. I'd looked at doing something similar, but I
wasn't sure that defining GLIBC_DYNAMIC_LINKER to a spec macro would
work :)

     -dann
> 
> diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
> index 80bd825..8498472 100644
> --- a/gcc/config/arm/linux-eabi.h
> +++ b/gcc/config/arm/linux-eabi.h
> @@ -62,7 +62,12 @@
>  /* 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/arm-linux-gnueabihf/ld-linux.so.3"
> +#define GLIBC_DYNAMIC_LINKER \
> +   "%{mhard-float:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
> +    %{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
> +    %{!mfloat-abi=hard:%{!mhard-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.  */
> 
> 
> which works for the following test cases:
>  gcc -mhard-float foo.c => /lib/arm-linux-gnueabihf/ld-linux.so.3
>  gcc -mfloat-abi=hard foo.c => /lib/arm-linux-gnueabihf/ld-linux.so.3
>  gcc -msoft-float foo.c => /lib/ld-linux.so.3
>  gcc -mfloat-abi=softfp foo.c => /lib/ld-linux.so.3
>  gcc -mbionic => /system/bin/linker
>  gcc -mbionic -mhard-float => /system/bin/linker
>  gcc -muclibc => /lib/ld-uClibc.so.0
>  gcc -muclibc -mhard-float => /lib/ld-uClibc.so.0
> 
> -- Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]