From fad92291a67d76d59acbfc33b817986871a3fd1e Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 27 Feb 2017 14:56:02 +0100 Subject: [PATCH] [ARC] Clean up arc header file. gcc/ 2017-02-27 Claudiu Zissulescu * config.gcc (arc*-): Clean up, use arc/big.h, arc/elf.h, and arc/linux.h headers. * config/arc/arc.h (TARGET_OS_CPP_BUILTINS): Remove. (LINK_SPEC): Likewise. (ARC_TLS_EXTRA_START_SPEC): Likewise. (EXTRA_SPECS): Likewise. (STARTFILE_SPEC): Likewise. (ENDFILE_SPEC): Likewise. (LIB_SPEC): Likewise. (TARGET_SDATA_DEFAULT): Likewise. (TARGET_MMEDIUM_CALLS_DEFAULT): Likewise. (MULTILIB_DEFAULTS): Likewise. (DWARF2_UNWIND_INFO): Likewise. * config/arc/big.h: New file. * config/arc/elf.h: Likewise. * config/arc/linux.h: Likewise. * config/arc/t-uClibc: Remove. From-SVN: r245759 --- gcc/config.gcc | 15 +++---- gcc/config/arc/arc.h | 115 +++++------------------------------------------- gcc/config/arc/big.h | 22 +++++++++ gcc/config/arc/elf.h | 55 +++++++++++++++++++++++ gcc/config/arc/linux.h | 76 ++++++++++++++++++++++++++++++++ gcc/config/arc/t-uClibc | 20 --------- 6 files changed, 170 insertions(+), 133 deletions(-) create mode 100644 gcc/config/arc/big.h create mode 100644 gcc/config/arc/elf.h create mode 100644 gcc/config/arc/linux.h delete mode 100644 gcc/config/arc/t-uClibc diff --git a/gcc/config.gcc b/gcc/config.gcc index 75f9f81..f7f6967 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -319,6 +319,7 @@ arc*-*-*) c_target_objs="arc-c.o" cxx_target_objs="arc-c.o" extra_options="${extra_options} arc/arc-tables.opt" + extra_headers="arc-simd.h" ;; arm*-*-*) cpu_type=arm @@ -1015,8 +1016,7 @@ alpha*-dec-*vms*) tmake_file="${tmake_file} alpha/t-vms alpha/t-alpha" ;; arc*-*-elf*) - extra_headers="arc-simd.h" - tm_file="arc/arc-arch.h dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tm_file="arc/arc-arch.h dbxelf.h elfos.h newlib-stdint.h arc/elf.h ${tm_file}" tmake_file="arc/t-multilib arc/t-arc" extra_gcc_objs="driver-arc.o" if test "x$with_cpu" != x; then @@ -1033,15 +1033,12 @@ arc*-*-elf*) *) echo "with_endian=${with_endian} not supported."; exit 1 ;; esac case ${with_endian} in - big*) tm_defines="DRIVER_ENDIAN_SELF_SPECS=\\\"%{!EL:%{!mlittle-endian:-mbig-endian}}\\\" ${tm_defines}" + big*) tm_file="arc/big.h ${tm_file}" esac ;; arc*-*-linux-uclibc*) - extra_headers="arc-simd.h" - tm_file="arc/arc-arch.h dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}" - tmake_file="${tmake_file} arc/t-uClibc arc/t-arc" - tm_defines="${tm_defines} TARGET_SDATA_DEFAULT=0" - tm_defines="${tm_defines} TARGET_MMEDIUM_CALLS_DEFAULT=1" + tm_file="arc/arc-arch.h dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arc/linux.h ${tm_file}" + tmake_file="${tmake_file} arc/t-arc" extra_gcc_objs="driver-arc.o" if test "x$with_cpu" != x; then tm_defines="${tm_defines} TARGET_CPU_BUILD=PROCESSOR_$with_cpu" @@ -1057,7 +1054,7 @@ arc*-*-linux-uclibc*) *) echo "with_endian=${with_endian} not supported."; exit 1 ;; esac case ${with_endian} in - big*) tm_defines="DRIVER_ENDIAN_SELF_SPECS=\\\"%{!EL:%{!mlittle-endian:-mbig-endian}}\\\" ${tm_defines}" + big*) tm_file="arc/big.h ${tm_file}" esac ;; arm-wrs-vxworks) diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 1341537..da19128 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1,14 +1,6 @@ /* Definitions of target machine for GNU compiler, Synopsys DesignWare ARC cpu. Copyright (C) 1994-2017 Free Software Foundation, Inc. - Sources derived from work done by Sankhya Technologies (www.sankhya.com) on - behalf of Synopsys Inc. - - Position Independent Code support added,Code cleaned up, - Comments and Support For ARC700 instructions added by - Saurabh Verma (saurabh.verma@codito.com) - Ramana Radhakrishnan(ramana.radhakrishnan@codito.com) - This file is part of GCC. GCC is free software; you can redistribute it and/or modify @@ -57,32 +49,9 @@ along with GCC; see the file COPYING3. If not see #define SYMBOL_REF_SHORT_CALL_P(X) \ ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SHORT_CALL) != 0) -#undef ASM_SPEC -#undef LINK_SPEC -#undef STARTFILE_SPEC -#undef ENDFILE_SPEC -#undef SIZE_TYPE -#undef PTRDIFF_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE -#undef ASM_APP_ON -#undef ASM_APP_OFF -#undef CC1_SPEC - /* Names to predefine in the preprocessor for this target machine. */ #define TARGET_CPU_CPP_BUILTINS() arc_cpu_cpp_builtins (pfile) -#if DEFAULT_LIBC == LIBC_UCLIBC - -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - GNU_USER_TARGET_OS_CPP_BUILTINS (); \ - } \ - while (0) - -#endif /* DEFAULT_LIBC == LIBC_UCLIBC */ - /* Macros enabled by specific command line option. FIXME: to be deprecatd. */ #define CPP_SPEC "\ @@ -94,6 +63,7 @@ along with GCC; see the file COPYING3. If not see %{mtelephony:-D__Xtelephony} %{mxy:-D__Xxy} %{mmul64: -D__Xmult32} \ %{mlock:-D__Xlock} %{mswape:-D__Xswape} %{mrtsc:-D__Xrtsc}" +#undef CC1_SPEC #define CC1_SPEC "\ %{EB:%{EL:%emay not use both -EB and -EL}} \ %{EB:-mbig-endian} %{EL:-mlittle-endian} \ @@ -103,71 +73,16 @@ extern const char *arc_cpu_to_as (int argc, const char **argv); #define EXTRA_SPEC_FUNCTIONS \ { "cpu_to_as", arc_cpu_to_as }, +#undef ASM_SPEC #define ASM_SPEC "%{mbig-endian|EB:-EB} %{EL} " \ "%:cpu_to_as(%{mcpu=*:%*}) %{mspfp*} %{mdpfp*} %{mfpu=fpuda*:-mfpuda}" #define OPTION_DEFAULT_SPECS \ {"cpu", "%{!mcpu=*:%{!mARC*:%{!marc*:%{!mA7:%{!mA6:-mcpu=%(VALUE)}}}}}" } -#if DEFAULT_LIBC == LIBC_UCLIBC -/* Note that the default is to link against dynamic libraries, if they are - available. Override with -static. */ -#define LINK_SPEC "%{h*} \ - %{static:-Bstatic} \ - %{symbolic:-Bsymbolic} \ - %{rdynamic:-export-dynamic}\ - -dynamic-linker /lib/ld-uClibc.so.0 \ - -X %{mbig-endian:-EB} \ - %{EB} %{EL} \ - %{marclinux*} \ - %{!marclinux*: %{mcpu=nps400:-marclinux_nps; :-marclinux}} \ - %{!z:-z max-page-size=0x2000 -z common-page-size=0x2000} \ - %{shared:-shared}" -#else -#define LINK_SPEC "%{mbig-endian:-EB} %{EB} %{EL}" -#endif - -#if DEFAULT_LIBC != LIBC_UCLIBC -#define ARC_TLS_EXTRA_START_SPEC "crttls.o%s" - -#define EXTRA_SPECS \ - { "arc_tls_extra_start_spec", ARC_TLS_EXTRA_START_SPEC }, \ - -#define STARTFILE_SPEC "%{pg|p:gcrt0.o%s}%{!pg:%{!p:crt0.o%s}} crti%O%s " \ - "%(arc_tls_extra_start_spec) crtbegin.o%s" -#else -#define STARTFILE_SPEC \ - LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) -#endif - -#if DEFAULT_LIBC != LIBC_UCLIBC -#define ENDFILE_SPEC "crtend.o%s crtn%O%s" -#else -#define ENDFILE_SPEC \ - LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) -#endif - -#if DEFAULT_LIBC == LIBC_UCLIBC -#undef LIB_SPEC -#define LIB_SPEC \ - "%{pthread:-lpthread} \ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -#else -#undef LIB_SPEC -#define LIB_SPEC "%{!shared:%{g*:-lg} -lc}" -#endif - #ifndef DRIVER_ENDIAN_SELF_SPECS #define DRIVER_ENDIAN_SELF_SPECS "" #endif -#ifndef TARGET_SDATA_DEFAULT -#define TARGET_SDATA_DEFAULT 1 -#endif -#ifndef TARGET_MMEDIUM_CALLS_DEFAULT -#define TARGET_MMEDIUM_CALLS_DEFAULT 0 -#endif #define DRIVER_SELF_SPECS DRIVER_ENDIAN_SELF_SPECS \ "%{mARC600|mA6: -mcpu=arc600 %arch_info->arch_id == BASE_ARCH_hs) #define TARGET_V2 (TARGET_EM || TARGET_HS) -#ifdef ARC_MULTILIB_CPU_DEFAULT -# ifndef MULTILIB_DEFAULTS -# define MULTILIB_DEFAULTS { "mcpu=" ARC_MULTILIB_CPU_DEFAULT } -# endif -#endif - #ifndef UNALIGNED_ACCESS_DEFAULT #define UNALIGNED_ACCESS_DEFAULT 0 #endif @@ -379,13 +288,18 @@ if (GET_MODE_CLASS (MODE) == MODE_INT \ /* Define this as 1 if `char' should by default be signed; else as 0. */ #define DEFAULT_SIGNED_CHAR 0 +#undef SIZE_TYPE #define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE #define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE #define WCHAR_TYPE "int" -#define WCHAR_TYPE_SIZE 32 +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 -/* ashwin : shifted from arc.c:102 */ #define PROGRAM_COUNTER_REGNO 63 /* Standard register usage. */ @@ -1168,10 +1082,12 @@ arc_select_cc_mode (OP, X, Y) /* Output to assembler file text saying following lines may contain character constants, extra white space, comments, etc. */ +#undef ASM_APP_ON #define ASM_APP_ON "" /* Output to assembler file text saying following lines no longer contain unusual constructs. */ +#undef ASM_APP_OFF #define ASM_APP_OFF "" /* Globalizing directive for a label. */ @@ -1467,15 +1383,6 @@ extern int arc_return_address_regs[4]; /* Frame info. */ -/* Define this macro to 0 if your target supports DWARF 2 frame unwind - information, but it does not yet work with exception handling. */ -/* N.B. the below test is valid in an #if, but not in a C expression. */ -#if DEFAULT_LIBC == LIBC_UCLIBC -#define DWARF2_UNWIND_INFO 1 -#else -#define DWARF2_UNWIND_INFO 0 -#endif - #define EH_RETURN_DATA_REGNO(N) \ ((N) < 4 ? (N) : INVALID_REGNUM) diff --git a/gcc/config/arc/big.h b/gcc/config/arc/big.h new file mode 100644 index 0000000..11e785e --- /dev/null +++ b/gcc/config/arc/big.h @@ -0,0 +1,22 @@ +/* Definition of big endian ARC machine for GNU compiler. + + Copyright (C) 2017 Free Software Foundation, Inc. + +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 3, 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 GCC; see the file COPYING3. If not see +. */ + +#undef DRIVER_ENDIAN_SELF_SPECS +#define DRIVER_ENDIAN_SELF_SPECS "%{!EL:%{!mlittle-endian:-mbig-endian}}" diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h new file mode 100644 index 0000000..d2106c5 --- /dev/null +++ b/gcc/config/arc/elf.h @@ -0,0 +1,55 @@ +/* Target macros for arc*-elf targets. + + Copyright (C) 2017 Free Software Foundation, Inc. + +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 3, 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 GCC; see the file COPYING3. If not see +. */ + +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 0 + +#undef LINK_SPEC +#define LINK_SPEC "%{mbig-endian:-EB} %{EB} %{EL}" + +#define ARC_TLS_EXTRA_START_SPEC "crttls.o%s" + +#define EXTRA_SPECS \ + { "arc_tls_extra_start_spec", ARC_TLS_EXTRA_START_SPEC }, \ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{pg|p:gcrt0.o%s}%{!pg:%{!p:crt0.o%s}} crti%O%s " \ + "%(arc_tls_extra_start_spec) crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s crtn%O%s" + +/* Leave the linker script to choose the appropriate libraries. */ +#undef LIB_SPEC +#define LIB_SPEC "" + +/* SDATA default for elf. */ +#undef TARGET_SDATA_DEFAULT +#define TARGET_SDATA_DEFAULT 1 + +/* We no medium calls. */ +#undef TARGET_MMEDIUM_CALLS_DEFAULT +#define TARGET_MMEDIUM_CALLS_DEFAULT 0 + +#ifdef ARC_MULTILIB_CPU_DEFAULT +# ifndef MULTILIB_DEFAULTS +# define MULTILIB_DEFAULTS { "mcpu=" ARC_MULTILIB_CPU_DEFAULT } +# endif +#endif diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h new file mode 100644 index 0000000..10c291c --- /dev/null +++ b/gcc/config/arc/linux.h @@ -0,0 +1,76 @@ +/* Target macros for arc*-*-linux targets. + + Copyright (C) 2017 Free Software Foundation, Inc. + +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 3, 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 GCC; see the file COPYING3. If not see +. */ + +/* Enable DWARF 2 exceptions. */ +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 1 + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + GNU_USER_TARGET_OS_CPP_BUILTINS (); \ + } \ + while (0) + +#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" +#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" + +/* Note that the default is to link against dynamic libraries, if they are + available. Override with -static. */ +#undef LINK_SPEC +#define LINK_SPEC "%{h*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + -X \ + %{mbig-endian:-EB} %{EB} %{EL} \ + %{!z:-z max-page-size=0x2000 -z common-page-size=0x2000} \ + %{mcpu=nps400:-marclinux_nps; :-marclinux}" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + +#undef LIB_SPEC +#define LIB_SPEC \ + "%{pthread:-lpthread} \ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + +/* No SDATA default for linux. */ +#undef TARGET_SDATA_DEFAULT +#define TARGET_SDATA_DEFAULT 0 + +/* We have medium calls. */ +#undef TARGET_MMEDIUM_CALLS_DEFAULT +#define TARGET_MMEDIUM_CALLS_DEFAULT 1 + +/* We do not have any MULTILIB_OPTIONS specified, so there are no + MULTILIB_DEFAULTS. */ +#undef MULTILIB_DEFAULTS diff --git a/gcc/config/arc/t-uClibc b/gcc/config/arc/t-uClibc deleted file mode 100644 index 96417a0..0000000 --- a/gcc/config/arc/t-uClibc +++ /dev/null @@ -1,20 +0,0 @@ -# GCC Makefile fragment for Synopsys DesignWare ARC with uClibc - -# Copyright (C) 2007-2017 Free Software Foundation, Inc. - -# 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 3, 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 GCC; see the file COPYING3. If not see -# . - -MULTILIB_EXTRA_OPTS = mno-sdata -- 2.7.4