From 1ad38120b5aafd9fdfd7862770d58b8d0d4aeb4e Mon Sep 17 00:00:00 2001 From: pbrook Date: Wed, 14 Feb 2007 00:29:52 +0000 Subject: [PATCH] 2007-02-13 Paul Brook gcc/ * config.gcc: Add arm*-*-uclinux-*eabi. * config/arm/uclinux-elf.h (TARGET_OS_CPP_BUILTINS): Define. (SUBTARGET_EXTRA_LINK_SPEC): Define. (STARTFILE_SPEC, ENDFILE_SPEC): Remove broken -shared handling. (LINK_GCC_C_SEQUENCE_SPEC): Undef. (LINK_SPEC): Define. (LIB_SPEC): Define. * config/arm/arm.c (arm_override_options): Use r9 as EABI PIC register. * config/arm/uclinux-eabi.h: New file. * config/arm/linux-eabi.h (WCHAR_TYPE): Remove. * config/arm/linux-gas.h (WCHAR_TYPE): Use unsigned long on AAPCS based targets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121902 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 +++++++ gcc/config.gcc | 14 +++++- gcc/config/arm/arm.c | 10 ++-- gcc/config/arm/linux-eabi.h | 5 -- gcc/config/arm/linux-gas.h | 6 ++- gcc/config/arm/{linux-eabi.h => uclinux-eabi.h} | 63 +++++++++---------------- gcc/config/arm/uclinux-elf.h | 48 ++++++++++++------- 7 files changed, 90 insertions(+), 72 deletions(-) copy gcc/config/arm/{linux-eabi.h => uclinux-eabi.h} (51%) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c6f08466c6..647cff1daf7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2007-02-13 Paul Brook + + * config.gcc: Add arm*-*-uclinux-*eabi. + * config/arm/uclinux-elf.h (TARGET_OS_CPP_BUILTINS): Define. + (SUBTARGET_EXTRA_LINK_SPEC): Define. + (STARTFILE_SPEC, ENDFILE_SPEC): Remove broken -shared handling. + (LINK_GCC_C_SEQUENCE_SPEC): Undef. + (LINK_SPEC): Define. + (LIB_SPEC): Define. + * config/arm/arm.c (arm_override_options): Use r9 as EABI PIC + register. + * config/arm/uclinux-eabi.h: New file. + * config/arm/linux-eabi.h (WCHAR_TYPE): Remove. + * config/arm/linux-gas.h (WCHAR_TYPE): Use unsigned long on AAPCS + based targets. + 2007-02-13 Ian Lance Taylor * common.opt: Add Wstrict-overflow and Wstrict-overflow=. diff --git a/gcc/config.gcc b/gcc/config.gcc index de39b9edeab..877d25c1842 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -731,8 +731,20 @@ arm*-*-linux*) # ARM GNU/Linux with ELF tm_file="$tm_file arm/aout.h arm/arm.h" ;; arm*-*-uclinux*) # ARM ucLinux - tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h" + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h arm/uclinux-elf.h" tmake_file="arm/t-arm arm/t-arm-elf" + case ${target} in + arm*-*-uclinux-*eabi) + tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h" + tmake_file="$tmake_file arm/t-bpabi" + # The BPABI long long divmod functions return a 128-bit value in + # registers r0-r3. Correctly modeling that requires the use of + # TImode. + need_64bit_hwint=yes + # The EABI requires the use of __cxa_atexit. + default_use_cxa_atexit=yes + esac + tm_file="$tm_file arm/aout.h arm/arm.h" ;; arm*-*-ecos-elf) tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c342f2fdac2..78f6d729803 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1145,11 +1145,6 @@ arm_override_options (void) && (TARGET_DEFAULT & MASK_APCS_FRAME)) warning (0, "-g with -mno-apcs-frame may not give sensible debugging"); - /* If stack checking is disabled, we can use r10 as the PIC register, - which keeps r9 available. */ - if (flag_pic && TARGET_SINGLE_PIC_BASE) - arm_pic_register = TARGET_APCS_STACK ? 9 : 10; - if (TARGET_APCS_FLOAT) warning (0, "passing floating point arguments in fp regs not yet supported"); @@ -1343,6 +1338,11 @@ arm_override_options (void) ARM_DOUBLEWORD_ALIGN ? "8, 32 or 64": "8 or 32"); } + /* If stack checking is disabled, we can use r10 as the PIC register, + which keeps r9 available. The EABI specifies r9 as the PIC register. */ + if (flag_pic && TARGET_SINGLE_PIC_BASE) + arm_pic_register = (TARGET_APCS_STACK || TARGET_AAPCS_BASED) ? 9 : 10; + if (arm_pic_register_string != NULL) { int pic_register = decode_reg_name (arm_pic_register_string); diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index 6612f742bf8..7215c0e9404 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -64,11 +64,6 @@ do not use -lfloat. */ #undef LIBGCC_SPEC -/* Use the AAPCS type for wchar_t, or the previous Linux default for - non-AAPCS. */ -#undef WCHAR_TYPE -#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int") - /* Clear the instruction cache from `beg' to `end'. This makes an inline system call to SYS_cacheflush. It is modified to work with both the original and EABI-only syscall interfaces. */ diff --git a/gcc/config/arm/linux-gas.h b/gcc/config/arm/linux-gas.h index 0544eb04187..715d2a575a3 100644 --- a/gcc/config/arm/linux-gas.h +++ b/gcc/config/arm/linux-gas.h @@ -36,8 +36,10 @@ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE "int" -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" +/* Use the AAPCS type for wchar_t, or the previous Linux default for + non-AAPCS. */ +#undef WCHAR_TYPE +#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int") #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/uclinux-eabi.h similarity index 51% copy from gcc/config/arm/linux-eabi.h copy to gcc/config/arm/uclinux-eabi.h index 6612f742bf8..3806bf9bac5 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/uclinux-eabi.h @@ -1,7 +1,6 @@ -/* Configuration file for ARM GNU/Linux EABI targets. - Copyright (C) 2004, 2005, 2006 - Free Software Foundation, Inc. - Contributed by CodeSourcery, LLC +/* Definitions for ARM EABI ucLinux + Copyright (C) 2006 Free Software Foundation, Inc. + Contributed by Paul Brook This file is part of GCC. @@ -16,10 +15,16 @@ License for more details. You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to + along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Override settings that are different to the uclinux-elf or + bpabi defaults. */ + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_SINGLE_PIC_BASE | MASK_INTERWORK) + /* On EABI GNU/Linux, we want both the BPABI builtins and the GNU/Linux builtins. */ #undef TARGET_OS_CPP_BUILTINS @@ -27,51 +32,26 @@ do \ { \ TARGET_BPABI_CPP_BUILTINS(); \ - LINUX_TARGET_OS_CPP_BUILTINS(); \ + builtin_define ("__uClinux__"); \ + builtin_define ("__gnu_linux__"); \ + builtin_define_std ("linux"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ } \ while (false) -/* We default to a soft-float ABI so that binaries can run on all - target hardware. */ -#undef TARGET_DEFAULT_FLOAT_ABI -#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT +#undef SUBTARGET_EXTRA_LINK_SPEC +#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" /* We default to the "aapcs-linux" ABI so that enums are int-sized by default. */ #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 -#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi - -#undef SUBTARGET_EXTRA_LINK_SPEC -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" - -/* 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" - -/* 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 -#define LINK_SPEC LINUX_TARGET_LINK_SPEC - -/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we - do not use -lfloat. */ -#undef LIBGCC_SPEC - -/* Use the AAPCS type for wchar_t, or the previous Linux default for - non-AAPCS. */ -#undef WCHAR_TYPE -#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int") - /* Clear the instruction cache from `beg' to `end'. This makes an - inline system call to SYS_cacheflush. It is modified to work with - both the original and EABI-only syscall interfaces. */ + inline system call to SYS_cacheflush. */ #undef CLEAR_INSN_CACHE #define CLEAR_INSN_CACHE(BEG, END) \ { \ @@ -79,7 +59,8 @@ register unsigned long _end __asm ("a2") = (unsigned long) (END); \ register unsigned long _flg __asm ("a3") = 0; \ register unsigned long _scno __asm ("r7") = 0xf0002; \ - __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \ + __asm __volatile ("swi 0x0 @ sys_cacheflush" \ : "=r" (_beg) \ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \ } + diff --git a/gcc/config/arm/uclinux-elf.h b/gcc/config/arm/uclinux-elf.h index 9f112cddaa2..d6dc4f60bdf 100644 --- a/gcc/config/arm/uclinux-elf.h +++ b/gcc/config/arm/uclinux-elf.h @@ -32,6 +32,21 @@ /* NOTE: The remaining definitions in this file are needed because uclinux does not use config/linux.h. */ +/* Add GNU/Linux builtins. */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__uClinux__"); \ + builtin_define ("__gnu_linux__"); \ + builtin_define_std ("linux"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ + } \ + while (false) + /* Do not assume anything about header files. */ #define NO_IMPLICIT_EXTERN_C @@ -39,32 +54,20 @@ #undef CPLUSPLUS_CPP_SPEC #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" -/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ +#undef SUBTARGET_EXTRA_LINK_SPEC +#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux" +/* Now we define the strings used to build the spec file. */ #undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ +#define STARTFILE_SPEC "crt1%O%s crti%O%s crtbegin%O%s" #undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" +#define ENDFILE_SPEC "crtend%O%s crtn%O%s" #undef CC1_SPEC #define CC1_SPEC "%{profile:-p}" +#undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC \ "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" @@ -72,3 +75,12 @@ #ifdef HAVE_LD_AS_NEEDED #define USE_LD_AS_NEEDED 1 #endif + +#undef LINK_SPEC +#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X -elf2flt" + +#undef LIB_SPEC +#define LIB_SPEC \ + "%{pthread:-lpthread} \ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" -- 2.11.4.GIT