From c147eacb9d2972a2adbabe57dcd28c327cc8c28a Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Wed, 14 Feb 2007 00:29:52 +0000 Subject: [PATCH] config.gcc: Add arm*-*-uclinux-*eabi. 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. From-SVN: r121902 --- 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/uclinux-eabi.h | 66 +++++++++++++++++++++++++++++++++++ gcc/config/arm/uclinux-elf.h | 48 +++++++++++++++---------- 7 files changed, 134 insertions(+), 31 deletions(-) create mode 100644 gcc/config/arm/uclinux-eabi.h 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/uclinux-eabi.h b/gcc/config/arm/uclinux-eabi.h new file mode 100644 index 00000000000..3806bf9bac5 --- /dev/null +++ b/gcc/config/arm/uclinux-eabi.h @@ -0,0 +1,66 @@ +/* Definitions for ARM EABI ucLinux + Copyright (C) 2006 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + 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 +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + TARGET_BPABI_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) + +#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 + +/* Clear the instruction cache from `beg' to `end'. This makes an + inline system call to SYS_cacheflush. */ +#undef CLEAR_INSN_CACHE +#define CLEAR_INSN_CACHE(BEG, END) \ +{ \ + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ + 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 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}}"