public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4561] Introduce support for vxworks7r2 on x86 and x86_64
@ 2020-10-30  8:26 Olivier Hainque
  0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2020-10-30  8:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9a835ba4c00bc5f183a26a5335f14a2a428a2b78

commit r11-4561-g9a835ba4c00bc5f183a26a5335f14a2a428a2b78
Author: Olivier Hainque <hainque@adacore.com>
Date:   Wed Feb 26 13:47:43 2020 +0000

    Introduce support for vxworks7r2 on x86 and x86_64
    
    This change extends the VxWorks support on intel CPUs to
    VxWorks7r2 for x86_64 as well as x86, with a "mcmodel=large"
    additional multilib for the 64bit configuration.
    
    The support for fPIC is not functional yet for this model,
    so we just don't add the corresponding multilib.
    
    We extend the range of CPU families handled by TARGET_OS_CPP_BUILTINS,
    accounting for the fact that archs older than PENTIUM4 are
    not supported (any more) by VxWorks 7.
    
    As we did for powerpc, we leverage VX_CPU_PREFIX to emit different
    forms of definitions for different families of VxWorks as the system
    headers's expectations has evolved between Vx 5, 6 and 7.
    
    2020-10-27  Olivier Hainque  <hainque@adacore.com>
    
    gcc/
            * config.gcc: Adjust the ix86/x86_64-wrs-vxworks filters
            to apply to VxWorks 7 as well.
            * config/i386/t-vxworks (MULTILIB_OPTIONS, MULTILIB_DIRNAMES):
            Remove the fPIC multilib and add one for the large code model
            on x86_64.
            * config/i386/vxworks.h: Separate sections for TARGET_VXWORKS7,
            other variants and common bits.
            (TARGET_OS_CPP_BUILTINS): Augment to support a range of CPU
            families. Leverage VX_CPU_PREFIX.
            (CC1_SPEC): Add definition.
            (STACK_CHECK_PROTECT): Use conditional expression instead of
            heavier to read conditioned macro definitions.
    
    libgcc/
            * config.host: Adjust the ix86/x86_64-wrs-vxworks filters
            to apply to VxWorks 7 as well.
    
    Co-authored-by: Douglas Rupp <rupp@adacore.com>
    Co-authored-by: Pat Bernardi <bernardi@adacore.com>

Diff:
---
 gcc/config.gcc            |  2 +-
 gcc/config/i386/t-vxworks | 19 ++++++++--
 gcc/config/i386/vxworks.h | 96 +++++++++++++++++++++++++++++++----------------
 libgcc/config.host        |  2 +-
 4 files changed, 81 insertions(+), 38 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index d14a1a3e812..b169f2fc3aa 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2050,7 +2050,7 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2*)
 		esac
 	fi
 	;;
-i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae|i[4567]86-wrs-vxworks7|x86_64-wrs-vxworks7)
+i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h"
 	case ${target} in
 	  x86_64-*)
diff --git a/gcc/config/i386/t-vxworks b/gcc/config/i386/t-vxworks
index c440b1f9031..8f5e8c73b71 100644
--- a/gcc/config/i386/t-vxworks
+++ b/gcc/config/i386/t-vxworks
@@ -1,8 +1,19 @@
 # Multilibs for VxWorks.
 
-# Build multilibs for normal, -mrtp, and -mrtp -fPIC.
-MULTILIB_OPTIONS = mrtp fPIC
-MULTILIB_DIRNAMES =
+# The common variant across the board is for -mrtp
+MULTILIB_OPTIONS = mrtp
+MULTILIB_DIRNAMES = mrtp
+
+# Then variants for the "large" code model on x86_64, or fPIC on x86,
+# RTP only. -fPIC -mrtp -mcmodel=large is not functional yet.
+ifneq (,$(findstring x86_64, $(target)))
+MULTILIB_OPTIONS += mcmodel=large
+MULTILIB_DIRNAMES += large
+else
+MULTILIB_OPTIONS += fPIC
+MULTILIB_DIRNAMES += fPIC
 MULTILIB_MATCHES = fPIC=fpic
-MULTILIB_EXCEPTIONS = fPIC
 
+# -fPIC is only supported in combination with -mrtp
+MULTILIB_EXCEPTIONS = fPIC
+endif
diff --git a/gcc/config/i386/vxworks.h b/gcc/config/i386/vxworks.h
index ad9404b40cc..891b4ff04b5 100644
--- a/gcc/config/i386/vxworks.h
+++ b/gcc/config/i386/vxworks.h
@@ -18,12 +18,21 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+/* VxWorks after 7 SR0600 use the ELF ABI and the system environment is llvm
+   based.  Earlier versions have GNU based environment components and use the
+   same ABI as Solaris 2.  */
+
+#if TARGET_VXWORKS7
+
+#undef VXWORKS_PERSONALITY
+#define VXWORKS_PERSONALITY "llvm"
+
+#else
+
 #undef ASM_OUTPUT_ALIGNED_BSS
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
 
-/* VxWorks uses the same ABI as Solaris 2, so use i386/sol2.h version.  */
-
 #undef TARGET_SUBTARGET_DEFAULT
 #define TARGET_SUBTARGET_DEFAULT \
 	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
@@ -41,43 +50,73 @@ along with GCC; see the file COPYING3.  If not see
 #undef SIZE_TYPE
 #define SIZE_TYPE (TARGET_LP64 ? "long unsigned int" : "unsigned int")
 
+/* We cannot use PC-relative accesses for VxWorks PIC because there is no
+   fixed gap between segments.  */
+#undef ASM_PREFERRED_EH_DATA_FORMAT
+
 #if TARGET_64BIT_DEFAULT
 #undef VXWORKS_SYSCALL_LIBS_RTP
 #define VXWORKS_SYSCALL_LIBS_RTP "-lsyscall"
 #endif
 
+#endif
+
+/* CPU macro definitions, ordered to account for VxWorks 7 not
+   supporting CPUs older than PENTIUM4 since SR0650.  */
+
+#define VX_CPUDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU=" #CPU)
+#define VX_CPUVDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU_VARIANT=" #CPU)
+
 #define TARGET_OS_CPP_BUILTINS()			\
   do							\
     {							\
       VXWORKS_OS_CPP_BUILTINS ();			\
-      if (TARGET_386)					\
-        builtin_define ("CPU=I80386");			\
+      if (TARGET_64BIT)					\
+	VX_CPUDEF (X86_64);				\
+      else if (TARGET_PENTIUM4)				\
+	{						\
+	  VX_CPUDEF (PENTIUM4);				\
+	  VX_CPUVDEF (PENTIUM4);			\
+	}						\
+      else if (TARGET_CORE2)				\
+	VX_CPUDEF (CORE2);				\
+      else if (TARGET_NEHALEM)				\
+	VX_CPUDEF (NEHALEM);				\
+      else if (TARGET_SANDYBRIDGE)			\
+	VX_CPUDEF (SANDYBRIDGE);			\
+      else if (TARGET_HASWELL)				\
+	VX_CPUDEF (HASWELL);				\
+      else if (TARGET_SILVERMONT)			\
+	VX_CPUDEF (SILVERMONT);				\
+      else if (TARGET_SKYLAKE || TARGET_SKYLAKE_AVX512) \
+	VX_CPUDEF (SKYLAKE);				\
+      else if (TARGET_GOLDMONT)				\
+	VX_CPUDEF (GOLDMONT);				\
+      else if (TARGET_VXWORKS7)				\
+	VX_CPUDEF (PENTIUM4);				\
+      else if (TARGET_386)				\
+	VX_CPUDEF (I80386);				\
       else if (TARGET_486)				\
-        builtin_define ("CPU=I80486");			\
+	VX_CPUDEF (I80486);				\
       else if (TARGET_PENTIUM)				\
-        {						\
-          builtin_define ("CPU=PENTIUM");		\
-          builtin_define ("CPU_VARIANT=PENTIUM");	\
-        }						\
+	{						\
+	  VX_CPUDEF (PENTIUM);				\
+	  VX_CPUVDEF (PENTIUM);				\
+	}						\
       else if (TARGET_PENTIUMPRO)			\
-        {						\
-          builtin_define ("CPU=PENTIUM2");		\
-          builtin_define ("CPU_VARIANT=PENTIUMPRO");	\
-        }						\
-      else if (TARGET_PENTIUM4)				\
-        {						\
-          builtin_define ("CPU=PENTIUM4");		\
-          builtin_define ("CPU_VARIANT=PENTIUM4");	\
-        }						\
-      else if (TARGET_64BIT)				\
-          builtin_define ("CPU=X86_64");		\
+	{						\
+	  VX_CPUDEF (PENTIUM2);				\
+	  VX_CPUVDEF (PENTIUMPRO);			\
+	}						\
       else						\
-          builtin_define ("CPU=I80386");		\
-    } 							\
+	VX_CPUDEF (I80386);				\
+    }							\
   while (0)
 
 #undef  CPP_SPEC
 #define CPP_SPEC VXWORKS_ADDITIONAL_CPP_SPEC
+#undef  CC1_SPEC
+#define CC1_SPEC VXWORKS_CC1_SPEC
 #undef  LIB_SPEC
 #define LIB_SPEC VXWORKS_LIB_SPEC
 #undef  STARTFILE_SPEC
@@ -97,18 +136,11 @@ along with GCC; see the file COPYING3.  If not see
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
 
-/* We cannot use PC-relative accesses for VxWorks PIC because there is no
-   fixed gap between segments.  */
-#undef ASM_PREFERRED_EH_DATA_FORMAT
-
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
 /* This platform supports the probing method of stack checking (RTP mode).
-   8K is reserved in the stack to propagate exceptions in case of overflow. 
+   8K is reserved in the stack to propagate exceptions in case of overflow.
    On 64-bit targets, we double that size.  */
-#if TARGET_64BIT_DEFAULT
-#define STACK_CHECK_PROTECT 16384
-#else
-#define STACK_CHECK_PROTECT 8192
-#endif
+
+#define STACK_CHECK_PROTECT (TARGET_64BIT_DEFAULT ? 16 * 1024 : 8 * 1024)
diff --git a/libgcc/config.host b/libgcc/config.host
index fd8e55e92e1..40823f0cff4 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -774,7 +774,7 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2*)
 	tm_file="${tm_file} i386/elf-lib.h"
 	md_unwind_header=i386/sol2-unwind.h
 	;;
-i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae|i[4567]86-wrs-vxworks7|x86_64-wrs-vxworks7)
+i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks*)
 	;;
 i[34567]86-*-cygwin*)
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o"


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-30  8:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  8:26 [gcc r11-4561] Introduce support for vxworks7r2 on x86 and x86_64 Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).