This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch ARM] Pass --be8 option for big endian targets by default
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: "Bharathi Seshadri (bseshadr)" <bseshadr at cisco dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "Jim Wilson (jimwilso)" <jimwilso at cisco dot com>
- Date: Wed, 25 Jul 2012 18:18:57 +0100
- Subject: Re: [Patch ARM] Pass --be8 option for big endian targets by default
- References: <5A40F62CC3B03A4C97590B91F1EB2C9901A546@xmb-aln-x14.cisco.com>
On 24/07/12 23:26, Bharathi Seshadri (bseshadr) wrote:
> Hi,
>
> Attached is a patch that modifies BE8_LINK_SPEC to pass -be8 option to the linker by default if the target is big endian, and to not pass -be8 option if -mlittle-endian is used. It also preserves the existing usage whereby -be8 gets passed with the use of -mbig-endian.
>
OK.
R.
> Patch:
> bash-3.00$ svn diff
> Index: gcc/ChangeLog
> ===================================================================
> --- gcc/ChangeLog (revision 189388)
> +++ gcc/ChangeLog (working copy)
> @@ -1,3 +1,9 @@
> +2012-07-10 Bharathi Seshadri <bseshadr@cisco.com>
> + Jim Wilson <jimwilso@cisco.com>
> +
> + * config/arm/bpabi.h (BE8_LINK_SPEC): Set according to
> + TARGET_BIG_ENDIAN_DEFAULT.
> +
> 2012-07-09 Jason Merrill <jason@redhat.com>
>
> PR c++/53882
> Index: gcc/config/arm/bpabi.h
> ===================================================================
> --- gcc/config/arm/bpabi.h (revision 189388)
> +++ gcc/config/arm/bpabi.h (working copy)
> @@ -55,15 +55,27 @@
> #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
> "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
>
> +#if TARGET_BIG_ENDIAN_DEFAULT
> #define BE8_LINK_SPEC \
> - " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5 \
> - |mcpu=cortex-a7 \
> - |mcpu=cortex-a8|mcpu=cortex-a9|mcpu=cortex-a15 \
> - |mcpu=generic-armv7-a \
> - |march=armv7-m|mcpu=cortex-m3 \
> - |march=armv7e-m|mcpu=cortex-m4 \
> - |march=armv6-m|mcpu=cortex-m0 \
> + " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5 \
> + |mcpu=cortex-a7 \
> + |mcpu=cortex-a8|mcpu=cortex-a9|mcpu=cortex-a15 \
> + |mcpu=generic-armv7-a \
> + |march=armv7-m|mcpu=cortex-m3 \
> + |march=armv7e-m|mcpu=cortex-m4 \
> + |march=armv6-m|mcpu=cortex-m0 \
> :%{!r:--be8}}}"
> +#else
> +#define BE8_LINK_SPEC \
> + " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5 \
> + |mcpu=cortex-a7 \
> + |mcpu=cortex-a8|mcpu=cortex-a9|mcpu=cortex-a15 \
> + |mcpu=generic-armv7-a \
> + |march=armv7-m|mcpu=cortex-m3 \
> + |march=armv7e-m|mcpu=cortex-m4 \
> + |march=armv6-m|mcpu=cortex-m0 \
> + :%{!r:--be8}}}"
> +#endif
>
> /* Tell the assembler to build BPABI binaries. */
> #undef SUBTARGET_EXTRA_ASM_SPEC
>
> Test:
> # Built arm-eabi and armeb-linux-gnueabi cross-compilers on Linux x86_64 on gcc trunk (as of 07/10/2012) .
> # Running the armeb-linux-gnueabi compiler with -v option shows that -be8 option is being passed by default; With -mlittle-endian, it can be seen that the option is not passed.
>
> bash-3.00$ cat ~/t1.c
> int
> main (void)
> {
> return 0;
> }
>
> bash-3.00$ armeb-linux-gnueabi-gcc -v ~/t1.c
> <snip>
> /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/libexec/gcc/armeb-linux-gnueabi/4.8.0/collect2 --sysroot=/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys --eh-frame-hdr --be8 -dynamic-linker /lib/ld-linux.so.3 -X -m armelfb_linux_eabi /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crt1.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crti.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/crtbegin.o -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0 -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/../../../../../x86_64-linux/armeb-linux-gnueabi/lib -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/lib -L/auto/compiler-dev/b
seshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib /tmp/ccA09qV0.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/crtend.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crtn.o
>
> bash-3.00$ armeb-linux-gnueabi-gcc -v -mlittle-endian ~/t1.c
> <snip>
> /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/libexec/gcc/armeb-linux-gnueabi/4.8.0/collect2 --sysroot=/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X -EL -m armelfb_linux_eabi /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crt1.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crti.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/crtbegin.o -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0 -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/../../../../../x86_64-linux/armeb-linux-gnueabi/lib -L/auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/lib -L/auto/compiler-dev/bse
shadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib /tmp/cckylg2b.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/lib/gcc/armeb-linux-gnueabi/4.8.0/crtend.o /auto/compiler-dev/bseshadr/gcc-trunk/build/c4.7.1-p0/x86_64-linux/armeb-linux-gnueabi/sys/usr/lib/crtn.o
>
> Bharathi
>
>