From ebcdba9c9f71e548e7506ecc8cb13139614b392e Mon Sep 17 00:00:00 2001 From: Pat Bernardi Date: Thu, 14 Nov 2019 15:45:50 +0000 Subject: [PATCH] Common ground work for vxworks7 ports updates 2019-11-06 Pat Bernardi Jerome Lambourg Olivier Hainque gcc/ * config.gcc: Add comment to introduce the TARGET_VXWORKS commong macro definitions, conveying VXWORKS7 or 64bit general variations. Add a block to set gcc_cv_initfini_array unconditionally to "yes" for VxWorks7. config/vx-common.h (VXWORKS_CC1_SPEC): New macro, empty string by default. Update some comments. config/vxworks.h (VXWORKS_EXTRA_LIBS_RTP): New macro, empty by default, to be added the end of VXWORKS_LIBS_RTP. (VXWORKS_LIBS_RTP): Replace hardcoded part by VXWORKS_BASE_LIBS_RTP and append VXWORKS_EXTRA_LIBS_RTP, both of which specific ports may redefine. (VXWORKS_NET_LIBS_RTP): Account for VxWorks7 specificities. (VXWORKS_CC1_SPEC): Common base definition, with VxWorks7 variation to account for the now available TLS abilities. (TARGET_LIBC_HAS_FUNCTION): Account for VxWorks7 abilities. (VXWORKS_HAVE_TLS): Likewise. Co-Authored-By: Jerome Lambourg Co-Authored-By: Olivier Hainque From-SVN: r278247 --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/config.gcc | 17 +++++++++++++++++ gcc/config/vx-common.h | 3 ++- gcc/config/vxworks.h | 31 ++++++++++++++++++++++++++----- 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bccc16..0deaff1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-11-06 Pat Bernardi + Jerome Lambourg + Olivier Hainque + + * config.gcc: Add comment to introduce the TARGET_VXWORKS + common macro definitions, conveying VXWORKS7 or 64bit general + variations. Add a block to set gcc_cv_initfini_array + unconditionally to "yes" for VxWorks7. + config/vx-common.h (VXWORKS_CC1_SPEC): New macro, empty string + by default. Update some comments. + config/vxworks.h (VXWORKS_EXTRA_LIBS_RTP): New macro, empty by + default, to be added the end of VXWORKS_LIBS_RTP. + (VXWORKS_LIBS_RTP): Replace hardcoded part by VXWORKS_BASE_LIBS_RTP + and append VXWORKS_EXTRA_LIBS_RTP, both of which specific ports may + redefine. + (VXWORKS_NET_LIBS_RTP): Account for VxWorks7 specificities. + (VXWORKS_CC1_SPEC): Common base definition, with VxWorks7 variation + to account for the now available TLS abilities. + (TARGET_LIBC_HAS_FUNCTION): Account for VxWorks7 abilities. + (VXWORKS_HAVE_TLS): Likewise. + 2019-11-14 Richard Sandiford * tree-vect-slp.c (vect_contains_pattern_stmt_p): New function. diff --git a/gcc/config.gcc b/gcc/config.gcc index 72f6564..aa9a79c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -962,6 +962,11 @@ case ${target} in "" | yes | vxworks) thread_file='vxworks' ;; *) echo 'Unknown thread configuration for VxWorks'; exit 1 ;; esac + + # A few common macro definitions conveying general characteristics + # of the configuration at hand. Note that by VxWorks 7, we mean the + # the SR6xx major update or beyond in vendor parlance: + case $target in *-*-vxworks7*) tm_defines="$tm_defines TARGET_VXWORKS7=1" @@ -972,6 +977,18 @@ case ${target} in tm_defines="$tm_defines TARGET_VXWORKS64=1" ;; esac + + # Then a few build configuration controls for VxWorks 7, which + # has specificities on top of which we aim to provide more complete + # C++ support: + + case $target in + *-*-vxworks7*) + # VxWorks 7 always has init/fini_array support and it is simpler to + # just leverage this, sticking to what the system toolchain does: + gcc_cv_initfini_array=yes + ;; + esac ;; *-*-elf|arc*-*-elf*) # Assume that newlib is being used and so __cxa_atexit is provided. diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h index d521bb3..2cbec74 100644 --- a/gcc/config/vx-common.h +++ b/gcc/config/vx-common.h @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #define VXWORKS_LIBGCC_SPEC "" #define VXWORKS_STARTFILE_SPEC "" #define VXWORKS_ENDFILE_SPEC "" +#define VXWORKS_CC1_SPEC "" /* VxWorks cannot have dots in constructor labels, because it uses a mutant variation of collect2 that generates C code instead of @@ -61,7 +62,7 @@ along with GCC; see the file COPYING3. If not see #undef DWARF2_UNWIND_INFO #define DWARF2_UNWIND_INFO 1 -/* VxWorks uses DWARF2. */ +/* VxWorks uses DWARF2 debugging info. */ #define DWARF2_DEBUGGING_INFO 1 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h index 0f604f1b..8c93a30 100644 --- a/gcc/config/vxworks.h +++ b/gcc/config/vxworks.h @@ -78,10 +78,23 @@ along with GCC; see the file COPYING3. If not see #define VXWORKS_SYSCALL_LIBS_RTP +#if TARGET_VXWORKS7 +#define VXWORKS_NET_LIBS_RTP "-lnet" +#else #define VXWORKS_NET_LIBS_RTP "-lnet -ldsi" +#endif + +#define VXWORKS_BASE_LIBS_RTP "-lc -lgcc -lc_internal" + +#define VXWORKS_EXTRA_LIBS_RTP #define VXWORKS_LIBS_RTP \ - VXWORKS_SYSCALL_LIBS_RTP " " VXWORKS_NET_LIBS_RTP " -lc -lgcc -lc_internal" + VXWORKS_SYSCALL_LIBS_RTP " " VXWORKS_NET_LIBS_RTP " " \ + VXWORKS_BASE_LIBS_RTP " " VXWORKS_EXTRA_LIBS_RTP + +/* TLS configuration. VxWorks 7 now always has proper TLS support. + Earlier versions did not, not even for RTPS. */ +#define VXWORKS_HAVE_TLS TARGET_VXWORKS7 /* On Vx6 and previous, the libraries to pick up depends on the architecture, so cannot be defined for all archs at once. On Vx7, a VSB is always needed @@ -134,10 +147,15 @@ along with GCC; see the file COPYING3. If not see #define VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}" #define VXWORKS_ENDFILE_SPEC "" -/* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ - -#define VXWORKS_HAVE_TLS (TARGET_VXWORKS7 && TARGET_VXWORKS_RTP) +#undef VXWORKS_CC1_SPEC +#if TARGET_VXWORKS7 +#define VXWORKS_CC1_SPEC \ + "%(cc1_cpu) %{!mrtp:%{!ftls-model=*:-ftls-model=local-exec}}" +#else +#define VXWORKS_CC1_SPEC "" +#endif +/* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ #undef VXWORKS_OVERRIDE_OPTIONS #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options () extern void vxworks_override_options (void); @@ -179,8 +197,11 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority); #undef SIZE_TYPE #define SIZE_TYPE (TARGET_VXWORKS64 ? "long unsigned int" : "unsigned int") +/* Assumptions on the target libc. VxWorks 7, post SR600, provides a C11 + runtime without sincos support. */ #undef TARGET_LIBC_HAS_FUNCTION -#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function +#define TARGET_LIBC_HAS_FUNCTION \ + (TARGET_VXWORKS7 ? default_libc_has_function : no_c99_libc_has_function) /* Both kernels and RTPs have the facilities required by this macro. */ #define TARGET_POSIX_IO -- 2.7.4