From fcc91c04d0fac35da7a0563e60d643387df5313e Mon Sep 17 00:00:00 2001 From: nickc Date: Thu, 8 Nov 2007 13:44:09 +0000 Subject: [PATCH] PR target/16350 * config.gcc: For arm*b-* define TARGET_BIG_ENDIAN_DEFAULT. * config/arm/linux-elf.h (TARGET_ENDIAN_DEFAULT): Define based on TARGET_BIG_ENDIAN_DEFAULT. Use for MULTILIB_DEFAULTS. (TARGET_DEFAULT): Set according to TARGET_ENDIAN_DEFAULT. (LINUX_TARGET_LINK_SPEC): Pass -mlittle-endian on to the assembler. * config/arm/linux-eabi.h (TARGET_LINKER_EMULATION): Set according to TARGET_BIG_ENDIAN_DEFAULT. (SUBTARGET_EXTRA_LINK_SPEC): Likewise. * gcc/config/arm/bpabi.h (TARGET_DEFAULT_MASK): Set according to TARGET_BIG_ENDIAN_DEFAULT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129999 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/config.gcc | 5 +++++ gcc/config/arm/bpabi.h | 18 +++++++++++++----- gcc/config/arm/linux-eabi.h | 27 ++++++++++++++++++--------- gcc/config/arm/linux-elf.h | 18 +++++++++++++++--- 5 files changed, 65 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 806240f..239455d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2007-11-07 Bernhard Fischer + + PR target/16350 + * config.gcc: For arm*b-* define TARGET_BIG_ENDIAN_DEFAULT. + * config/arm/linux-elf.h (TARGET_ENDIAN_DEFAULT): Define based on + TARGET_BIG_ENDIAN_DEFAULT. Use for MULTILIB_DEFAULTS. + (TARGET_DEFAULT): Set according to TARGET_ENDIAN_DEFAULT. + (LINUX_TARGET_LINK_SPEC): Pass -mlittle-endian on to the assembler. + * config/arm/linux-eabi.h (TARGET_LINKER_EMULATION): Set according + to TARGET_BIG_ENDIAN_DEFAULT. + (SUBTARGET_EXTRA_LINK_SPEC): Likewise. + * gcc/config/arm/bpabi.h (TARGET_DEFAULT_MASK): Set according + to TARGET_BIG_ENDIAN_DEFAULT. + 2007-11-07 Diego Novillo * tree.h (struct tree_struct_field_tag): Move field diff --git a/gcc/config.gcc b/gcc/config.gcc index a46dbd6..0fc329c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -704,6 +704,11 @@ arm*-*-netbsd*) ;; arm*-*-linux*) # ARM GNU/Linux with ELF tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + case $target in + arm*b-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac tmake_file="${tmake_file} t-linux arm/t-arm" case ${target} in arm*-*-linux-*eabi) diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h index 65d28b9..a67f649 100644 --- a/gcc/config/arm/bpabi.h +++ b/gcc/config/arm/bpabi.h @@ -29,12 +29,20 @@ #define TARGET_UNWIND_INFO 1 /* Section 4.1 of the AAPCS requires the use of VFP format. */ -#undef FPUTYPE_DEFAULT +#undef FPUTYPE_DEFAULT #define FPUTYPE_DEFAULT FPUTYPE_VFP +/* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ +#if TARGET_BIG_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END +#else +#define TARGET_ENDIAN_DEFAULT 0 +#endif + /* EABI targets should enable interworking by default. */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT MASK_INTERWORK +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) /* The ARM BPABI functions return a boolean; they use no special calling convention. */ @@ -44,11 +52,11 @@ #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI /* Tell the assembler to build BPABI binaries. */ -#undef SUBTARGET_EXTRA_ASM_SPEC +#undef SUBTARGET_EXTRA_ASM_SPEC #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=4}" /* The generic link spec in elf.h does not support shared libraries. */ -#undef LINK_SPEC +#undef LINK_SPEC #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} " \ "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \ "-X" diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index f1e34d1..4174d70 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -21,7 +21,7 @@ /* On EABI GNU/Linux, we want both the BPABI builtins and the GNU/Linux builtins. */ -#undef TARGET_OS_CPP_BUILTINS +#undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do \ { \ @@ -32,31 +32,40 @@ /* We default to a soft-float ABI so that binaries can run on all target hardware. */ -#undef TARGET_DEFAULT_FLOAT_ABI +#undef TARGET_DEFAULT_FLOAT_ABI #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT /* We default to the "aapcs-linux" ABI so that enums are int-sized by default. */ -#undef ARM_DEFAULT_ABI +#undef ARM_DEFAULT_ABI #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX /* Default to armv5t so that thumb shared libraries work. The ARM10TDMI core is the default for armv5t, so set SUBTARGET_CPU_DEFAULT to achieve this. */ -#undef SUBTARGET_CPU_DEFAULT +#undef SUBTARGET_CPU_DEFAULT #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi -#undef SUBTARGET_EXTRA_LINK_SPEC -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" +/* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ +#undef TARGET_LINKER_EMULATION +#if TARGET_BIG_ENDIAN_DEFAULT +#define TARGET_LINKER_EMULATION "armelfb_linux_eabi" +#else +#define TARGET_LINKER_EMULATION "armelf_linux_eabi" +#endif + +#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. */ -#undef GLIBC_DYNAMIC_LINKER +#undef GLIBC_DYNAMIC_LINKER #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3" /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to use the GNU/Linux version, not the generic BPABI version. */ -#undef LINK_SPEC +#undef LINK_SPEC #define LINK_SPEC LINUX_TARGET_LINK_SPEC /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we @@ -65,7 +74,7 @@ /* Clear the instruction cache from `beg' to `end'. This makes an inline system call to SYS_cacheflush. */ -#undef CLEAR_INSN_CACHE +#undef CLEAR_INSN_CACHE #define CLEAR_INSN_CACHE(BEG, END) \ { \ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index c3ff9c4..54eba14 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -30,12 +30,24 @@ #undef TARGET_DEFAULT_FLOAT_ABI #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD +/* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ +#if TARGET_BIG_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END +#define TARGET_ENDIAN_OPTION "mbig-endian" +#define TARGET_LINKER_EMULATION "armelfb_linux" +#else +#define TARGET_ENDIAN_DEFAULT 0 +#define TARGET_ENDIAN_OPTION "mlittle-endian" +#define TARGET_LINKER_EMULATION "armelf_linux" +#endif + #undef TARGET_DEFAULT -#define TARGET_DEFAULT (0) +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" #undef MULTILIB_DEFAULTS #define MULTILIB_DEFAULTS \ @@ -60,7 +72,7 @@ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \ -X \ - %{mbig-endian:-EB}" \ + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ SUBTARGET_EXTRA_LINK_SPEC #undef LINK_SPEC -- 2.7.4