From 83dd7eef425bbcd24ee50e11febbc8b42ac35b34 Mon Sep 17 00:00:00 2001 From: hjl Date: Fri, 13 Apr 2012 17:21:06 +0000 Subject: [PATCH] Add and use config/i386/gnu-user-common.h * config.gcc: Add i386/gnu-user-common.h before all i386/gnu-user.h and i386/gnu-user64.h usages. * config/i386/gnu-user-common.h: New. * config/i386/gnu-user.h (CPP_SPEC): Moved to gnu-user-common.h. (CC1_SPEC): Likewise. (ENDFILE_SPEC): Likewise. (DEFAULT_PCC_STRUCT_RETURN): Likewise. (TARGET_TLS_DIRECT_SEG_REFS_DEFAULT): Likewise. (TARGET_OS_CPP_BUILTINS): Likewise. (LIBGCC2_HAS_TF_MODE): Likewise. (LIBGCC2_TF_CEXT): Likewise. (TF_SIZE): Likewise. (TARGET_ASM_FILE_END): Likewise. (STACK_CHECK_MOVING_SP): Likewise. (STACK_CHECK_STATIC_BUILTIN): Likewise. * config/i386/gnu-user64.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186427 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 +++++++++++++ gcc/config.gcc | 14 ++++----- gcc/config/i386/gnu-user-common.h | 66 +++++++++++++++++++++++++++++++++++++++ gcc/config/i386/gnu-user.h | 45 -------------------------- gcc/config/i386/gnu-user64.h | 49 +---------------------------- 5 files changed, 95 insertions(+), 100 deletions(-) create mode 100644 gcc/config/i386/gnu-user-common.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 721f681..e3a691e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2012-04-13 Enkovich Ilya + + * config.gcc: Add i386/gnu-user-common.h before all + i386/gnu-user.h and i386/gnu-user64.h usages. + + * config/i386/gnu-user-common.h: New. + + * config/i386/gnu-user.h (CPP_SPEC): Moved to gnu-user-common.h. + (CC1_SPEC): Likewise. + (ENDFILE_SPEC): Likewise. + (DEFAULT_PCC_STRUCT_RETURN): Likewise. + (TARGET_TLS_DIRECT_SEG_REFS_DEFAULT): Likewise. + (TARGET_OS_CPP_BUILTINS): Likewise. + (LIBGCC2_HAS_TF_MODE): Likewise. + (LIBGCC2_TF_CEXT): Likewise. + (TF_SIZE): Likewise. + (TARGET_ASM_FILE_END): Likewise. + (STACK_CHECK_MOVING_SP): Likewise. + (STACK_CHECK_STATIC_BUILTIN): Likewise. + * config/i386/gnu-user64.h: Likewise. + 2012-04-13 Martin Jambor * expr.c (expand_expr_real_1): Pass type, not the expression, to diff --git a/gcc/config.gcc b/gcc/config.gcc index 3eb2c70..bf3b2c3 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1228,7 +1228,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i # Assume modern glibc default_gnu_indirect_function=yes if test x$enable_targets = xall; then - tm_file="${tm_file} i386/x86-64.h i386/gnu-user64.h i386/linux64.h" + tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux64.h" tm_defines="${tm_defines} TARGET_BI_ARCH=1" tmake_file="${tmake_file} i386/t-linux64" x86_multilibs="${with_multilib_list}" @@ -1263,26 +1263,26 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i ;; esac else - tm_file="${tm_file} i386/gnu-user.h i386/linux.h" + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h i386/linux.h" fi ;; i[34567]86-*-knetbsd*-gnu) - tm_file="${tm_file} i386/gnu-user.h knetbsd-gnu.h i386/knetbsd-gnu.h" + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h knetbsd-gnu.h i386/knetbsd-gnu.h" ;; i[34567]86-*-kfreebsd*-gnu) - tm_file="${tm_file} i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;; i[34567]86-*-kopensolaris*-gnu) - tm_file="${tm_file} i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h" + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h" ;; i[34567]86-*-gnu*) - tm_file="$tm_file i386/gnu-user.h gnu.h i386/gnu.h" + tm_file="$tm_file i386/gnu-user-common.h i386/gnu-user.h gnu.h i386/gnu.h" ;; esac ;; x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h \ - i386/x86-64.h i386/gnu-user64.h" + i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h" case ${target} in x86_64-*-linux*) tm_file="${tm_file} linux.h i386/linux64.h" diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h new file mode 100644 index 0000000..6ca954d --- /dev/null +++ b/gcc/config/i386/gnu-user-common.h @@ -0,0 +1,66 @@ +/* Common definitions for Intel 386 and AMD x86-64 systems using + GNU userspace. Copyright (C) 2012 Free Software Foundation, Inc. + Contributed by Ilya Enkovich. + +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 +. */ + +/* The svr4 ABI for the i386 says that records and unions are returned + in memory. In the 64bit compilation we will turn this flag off in + ix86_option_override_internal, as we never do pcc_struct_return + scheme on this target. */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 1 + +/* We arrange for the whole %fs segment to map the tls area. */ +#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT +#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + } \ + while (0) + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +#undef CC1_SPEC +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" + +/* Similar to standard GNU userspace, but adding -ffast-math support. */ +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{mpc32:crtprec32.o%s} \ + %{mpc64:crtprec64.o%s} \ + %{mpc80:crtprec80.o%s} \ + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + +/* Put all *tf routines in libgcc. */ +#undef LIBGCC2_HAS_TF_MODE +#define LIBGCC2_HAS_TF_MODE 1 +#define LIBGCC2_TF_CEXT q +#define TF_SIZE 113 + +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + +/* The stack pointer needs to be moved while checking the stack. */ +#define STACK_CHECK_MOVING_SP 1 + +/* Static stack checking is supported by means of probes. */ +#define STACK_CHECK_STATIC_BUILTIN 1 diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index 98d0a25..3b48b00 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -24,15 +24,6 @@ along with GCC; see the file COPYING3. If not see /* The .file command should always begin the output. */ #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 1 - -/* We arrange for the whole %gs segment to map the tls area. */ -#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT -#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS - #undef ASM_COMMENT_START #define ASM_COMMENT_START "#" @@ -67,19 +58,6 @@ along with GCC; see the file COPYING3. If not see #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - GNU_USER_TARGET_OS_CPP_BUILTINS(); \ - } \ - while (0) - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" - -#undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" - /* Provide a LINK_SPEC appropriate for GNU userspace. Here we provide support for the special GCC options -static and -shared, which allow us to link things in one of these three modes by applying the appropriate @@ -105,15 +83,6 @@ along with GCC; see the file COPYING3. If not see -dynamic-linker %(dynamic_linker)} \ %{static:-static}}" -/* Similar to standard GNU userspace, but adding -ffast-math support. */ -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ - %{mpc32:crtprec32.o%s} \ - %{mpc64:crtprec64.o%s} \ - %{mpc80:crtprec80.o%s} \ - %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" - /* A C statement (sans semicolon) to output to the stdio stream FILE the assembler definition of uninitialized global DECL named NAME whose size is SIZE bytes and alignment is ALIGN bytes. @@ -180,20 +149,6 @@ along with GCC; see the file COPYING3. If not see : "=d"(BASE)) #endif -/* Put all *tf routines in libgcc. */ -#undef LIBGCC2_HAS_TF_MODE -#define LIBGCC2_HAS_TF_MODE 1 -#define LIBGCC2_TF_CEXT q -#define TF_SIZE 113 - -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack - -/* The stack pointer needs to be moved while checking the stack. */ -#define STACK_CHECK_MOVING_SP 1 - -/* Static stack checking is supported by means of probes. */ -#define STACK_CHECK_STATIC_BUILTIN 1 - #ifdef TARGET_LIBC_PROVIDES_SSP /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ #define TARGET_THREAD_SSP_OFFSET 0x14 diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h index 6f7b5de..1ec5e20 100644 --- a/gcc/config/i386/gnu-user64.h +++ b/gcc/config/i386/gnu-user64.h @@ -24,30 +24,6 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - GNU_USER_TARGET_OS_CPP_BUILTINS(); \ - } \ - while (0) - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" - -#undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. In the 64bit compilation we will turn this flag off in - ix86_option_override_internal, as we never do pcc_struct_return - scheme on this target. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 1 - -/* We arrange for the whole %fs segment to map the tls area. */ -#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT -#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS - /* Provide a LINK_SPEC. Here we provide support for the special GCC options -static and -shared, which allow us to link things in one of these three modes by applying the appropriate combinations of @@ -90,15 +66,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see %{" SPEC_X32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}} \ %{static:-static}}" -/* Similar to standard GNU userspace, but adding -ffast-math support. */ -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ - %{mpc32:crtprec32.o%s} \ - %{mpc64:crtprec64.o%s} \ - %{mpc80:crtprec80.o%s} \ - %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" - #if TARGET_64BIT_DEFAULT #if TARGET_BI_ARCH == 2 #define MULTILIB_DEFAULTS { "mx32" } @@ -109,23 +76,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MULTILIB_DEFAULTS { "m32" } #endif -/* Put all *tf routines in libgcc. */ -#undef LIBGCC2_HAS_TF_MODE -#define LIBGCC2_HAS_TF_MODE 1 -#define LIBGCC2_TF_CEXT q -#define TF_SIZE 113 - -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack - -/* The stack pointer needs to be moved while checking the stack. */ -#define STACK_CHECK_MOVING_SP 1 - -/* Static stack checking is supported by means of probes. */ -#define STACK_CHECK_STATIC_BUILTIN 1 - #ifdef TARGET_LIBC_PROVIDES_SSP /* i386 glibc provides __stack_chk_guard in %gs:0x14, - x32 glibc provides it in %fs:0x18. + x32 glibc provides it in %fs:0x18. x86_64 glibc provides it in %fs:0x28. */ #define TARGET_THREAD_SSP_OFFSET \ (TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14) -- 2.7.4