]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Update the arm-*-vxworks* support
authorJerome Lambourg <lambourg@adacore.com>
Thu, 14 Nov 2019 16:11:30 +0000 (16:11 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Thu, 14 Nov 2019 16:11:30 +0000 (16:11 +0000)
2019-11-13  Jerome Lambourg  <lambourg@adacore.com>
            Doug Rupp <rupp@adacore.com>
            Olivier Hainque  <hainque@adacore.com>

gcc/
* config.gcc: Collapse the arm-vxworks entries into
a single arm-wrs-vxworks7* one, bpabi based.  Update
the default cpu from arm8 to armv7-a
* config/arm/vxworks.h (CC1_SPEC): Simplify, knowing that
we always use ARM_UNWIND_INFO.
(DWARF2_UNWIND_INFO): Remove redefinition.
(ARM_TARGET2_DWARF_FORMAT): Likewise.
(VXWORKS_PERSONALITY): Define, to "llvm".
(VXWORKS_EXTRA_LIBS_RTP): Define, to "-lllvm".

libgcc/
* config.host: Collapse the arm-vxworks entries into
a single arm-wrs-vxworks7* one.
* config/arm/unwind-arm-vxworks.c: Update comments.  Provide
__gnu_Unwind_Find_exidx and a weak dummy __cxa_type_match for
kernel modules, to be overriden by libstdc++ when we link with
it.  Rely on externally provided __exidx_start/end.

Co-Authored-By: Doug Rupp <rupp@adacore.com>
Co-Authored-By: Olivier Hainque <hainque@adacore.com>
From-SVN: r278253

gcc/ChangeLog
gcc/config.gcc
gcc/config/arm/t-vxworks
gcc/config/arm/vxworks.h
libgcc/ChangeLog
libgcc/config.host
libgcc/config/arm/unwind-arm-vxworks.c

index ddba96a92785055abdae5b38ff9bcd53cad2a9c3..7140f5acc1d98a9cd48fc9eaa7e61c7d7a7fb1de 100644 (file)
@@ -1,3 +1,17 @@
+2019-11-14  Jerome Lambourg  <lambourg@adacore.com>
+           Doug Rupp <rupp@adacore.com>
+           Olivier Hainque  <hainque@adacore.com>
+
+       * config.gcc: Collapse the arm-vxworks entries into
+       a single arm-wrs-vxworks7* one, bpabi based.  Update
+       the default cpu from arm8 to armv7-a
+       * config/arm/vxworks.h (CC1_SPEC): Simplify, knowing that
+       we always use ARM_UNWIND_INFO.
+       (DWARF2_UNWIND_INFO): Remove redefinition.
+       (ARM_TARGET2_DWARF_FORMAT): Likewise.
+       (VXWORKS_PERSONALITY): Define, to "llvm".
+       (VXWORKS_EXTRA_LIBS_RTP): Define, to "-lllvm".
+
 2019-11-14  Jerome Lambourg  <lambourg@adacore.com>
 
        * config/arm/vxworks.h (TARGET_OS_CPP_BUILTINS): Use
index ea45b44a212ba4d88ff9e7b7e895416c7a4fe266..5aa0130135fa3ce95df502b3f84e78832b368375 100644 (file)
@@ -1148,23 +1148,17 @@ arc*-*-linux*)
        # automatically detect that GAS supports it, yet we require it.
        gcc_cv_initfini_array=yes
        ;;
-arm-wrs-vxworks|arm-wrs-vxworks7)
+arm-wrs-vxworks7*)
+       # We only support VxWorks 7 now on ARM, post SR600.  Pre SR600
+       # VxWorks 7 was transitory and major versions prior to 7 were based
+       # on long deprecated ABI, not supported at all any more regardless
+       # of VxWorks.
        extra_options="${extra_options} arm/vxworks.opt"
-       tmake_file="${tmake_file} arm/t-arm arm/t-vxworks"
-        case $target in
-       *-vxworks7)
-            # VxWorks7 on ARM adheres to the ARM Base Platform ABI
-           tmake_file="${tmake_file} arm/t-bpabi"
-           tm_file="arm/bpabi.h ${tm_file}"
-           # The BPABI long long divmod functions return a 128-bit value in
-           # registers r0-r3.
-           need_64bit_hwint=yes
-           default_use_cxa_atexit=yes
-           ;;
-        *)  ;;
-        esac
-        tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
-       target_cpu_cname="arm8"
+       tmake_file="${tmake_file} arm/t-arm arm/t-vxworks arm/t-bpabi"
+       tm_file="elfos.h arm/elf.h arm/bpabi.h arm/aout.h ${tm_file}"
+       tm_file="${tm_file} vx-common.h vxworks.h arm/vxworks.h"
+       target_cpu_cname="armv7-a"
+       need_64bit_hwint=yes
        ;;
 arm*-*-freebsd*)                # ARM FreeBSD EABI
        tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h"
index 504d5ccd1b56afe84fc68c155bc940579e62733c..865eabcffe4f77c9c25a87b83722def773335489 100644 (file)
@@ -16,7 +16,8 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-MULTILIB_OPTIONS = mrtp fPIC
+# Multilibs for ARM VxWorks.  With the move to VxWorks 7, we only
+# support -mrtp variation on top of the default settings at this
+# stage, without PIC.
 
-# -fPIC alone is not supported, only together with -mrtp
-MULTILIB_EXCEPTIONS = fPIC
+MULTILIB_OPTIONS = mrtp
index f03b19a1fbd6660e6dacf4f934851a6eada606a4..8118e6ef6832e8e6cb22e6c7e75e53eb390ec0b3 100644 (file)
@@ -84,15 +84,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 /* .text.hot and .text.unlikely sections are badly handled by the
    VxWorks kernel mode loader for ARM style exceptions.  */
-
-#if ARM_UNWIND_INFO
-#define EXTRA_CC1_SPEC "%{!mrtp:-fno-reorder-functions}"
-#else
-#define EXTRA_CC1_SPEC
-#endif
-
 #undef  CC1_SPEC
-#define CC1_SPEC "" EXTRA_CC1_SPEC
+#define CC1_SPEC VXWORKS_CC1_SPEC " %{!mrtp:-fno-reorder-functions}"
 
 /* Translate an explicit -mbig-endian as an explicit -EB to assembler
    and linker, and pass abi options matching the target expectations
@@ -121,14 +114,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
 
-/* For exceptions, pre VX7 uses DWARF2 info, VX7 uses ARM unwinding.  */
-#undef  DWARF2_UNWIND_INFO
-#define DWARF2_UNWIND_INFO (!TARGET_VXWORKS7)
-
-#undef ARM_TARGET2_DWARF_FORMAT
-#define ARM_TARGET2_DWARF_FORMAT \
-  (TARGET_VXWORKS_RTP ? (DW_EH_PE_pcrel | DW_EH_PE_indirect) : DW_EH_PE_absptr)
-
 /* There is no default multilib.  */
 #undef MULTILIB_DEFAULTS
 
@@ -160,3 +145,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 /* Unless overridded by the target options, the default is little-endian.  */
 #define TARGET_ENDIAN_DEFAULT 0
+
+/* The VxWorks environment on ARM is llvm based and we need to link
+   against libllvm.a to resolve __aeabi_memcpy4.  */
+
+#undef VXWORKS_PERSONALITY
+#define VXWORKS_PERSONALITY "llvm"
+
+#undef VXWORKS_EXTRA_LIBS_RTP
+#define VXWORKS_EXTRA_LIBS_RTP "-lllvm"
index dfb30a6571f0e3ee49a2773f8ab9f31ea889eaf0..dfc842d012562fe0afb22aabf31b3e1f6a24a5dd 100644 (file)
@@ -1,3 +1,14 @@
+2019-11-14  Jerome Lambourg  <lambourg@adacore.com>
+           Doug Rupp <rupp@adacore.com>
+           Olivier Hainque  <hainque@adacore.com>
+
+       * config.host: Collapse the arm-vxworks entries into
+       a single arm-wrs-vxworks7* one.
+       * config/arm/unwind-arm-vxworks.c: Update comments.  Provide
+       __gnu_Unwind_Find_exidx and a weak dummy __cxa_type_match for
+       kernel modules, to be overriden by libstdc++ when we link with
+       it.  Rely on externally provided __exidx_start/end.
+
 2019-11-14  Doug Rupp  <rupp@adacore.com>
            Olivier Hainque  <hainque@adacore.com>
 
index 1c8d63be83793fd6d9351a81343bcf2524c799af..303516879cd1257901d1086ee3543d55d334bc11 100644 (file)
@@ -438,18 +438,12 @@ arc*-*-linux*)
        extra_parts="$extra_parts crttls.o"
        md_unwind_header=arc/linux-unwind.h
        ;;
-arm-wrs-vxworks|arm-wrs-vxworks7)
-       tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+arm-wrs-vxworks7*)
+       tmake_file="$tmake_file arm/t-arm arm/t-elf arm/t-bpabi arm/t-vxworks7"
+        tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+       tm_file="$tm_file arm/bpabi-lib.h"
+       unwind_header=config/arm/unwind-arm.h
        extra_parts="$extra_parts crti.o crtn.o"
-       case ${host} in
-       *-*-vxworks7)
-         # Note that arm/t-bpabi will reset the LIB2ADDEH macro.
-         # This is intentional.
-         tmake_file="$tmake_file arm/t-bpabi arm/t-vxworks7"
-         tm_file="$tm_file arm/bpabi-lib.h"
-         unwind_header=config/arm/unwind-arm.h
-         ;;
-       esac
        ;;
 arm*-*-freebsd*)                # ARM FreeBSD EABI
        tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix arm/t-elf"
index 03d753d2efb5c6325abf59a883ea21ab23120674..6fccf10b3c822b40665f994fb26db04d0b235ea9 100644 (file)
@@ -1,4 +1,4 @@
-/* Support for ARM EABI unwinding in VxWorks Downloadable Kernel Modules.
+/* Support for ARM EABI unwinding on VxWorks Downloadable Kernel Modules.
    Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
    This file is free software; you can redistribute it and/or modify it
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if defined(__vxworks) && !defined (__RTP__)
-/* Vxworks for ARM uses __gnu_Unwind_Find_exidx to retrieve the exception
-   table for downloadable kernel modules.  As those modules are only partially
-   linked, the linker won't generate __exidx_start|end, but the two symbols
-   are still used in alternate paths from unwind-arm-common.inc.
+/* The common unwinding code refers to __gnu_Unwind_Find_exidx and
+   __cxa_type_match symbols, which are not in VxWorks kernels on ARM,
+   now llvm based.
+
+   While the common code works just fine for RTPs thanks to weak references
+   and proper positioning of __exidx_start/end from linker scripts, we need
+   symbol definitions for kernel modules.  */
+
+#ifndef __RTP__
+
+#include <private/moduleLibP.h>
+
+/* __gnu_Unwind_Find_exidx.  See if we can use _func_moduleExidxGet to
+   refine whatever we have in __exidx_start and __exidx_end.  */
+
+typedef struct
+{
+  UINT32 fnoffset;
+  UINT32 content;
+} __EIT_entry;
+
+extern __EIT_entry __exidx_start;
+extern __EIT_entry __exidx_end;
+
+__EIT_entry *
+__gnu_Unwind_Find_exidx (void *pc, int *nrec)
+{
+  __EIT_entry *pstart = 0;
+  __EIT_entry *pend = 0;
+
+  if (_func_moduleExidxGet != NULL)
+    _func_moduleExidxGet (pc,
+                         (void *) &__exidx_start, (void *) &__exidx_end,
+                         (void **) &pstart, (void **) &pend);
+
+  if (!pstart)
+    {
+      pstart = &__exidx_start;
+      pend = &__exidx_end;
+    }
+
+  *nrec = pend - pstart;
+
+  return pstart;
+}
+
+/* __cxa_type_match.  A dummy version to be overridden by the libstdc++ one
+ when we link with it.  */
+
+void * __attribute__((weak))
+__cxa_type_match ()
+{
+  return (void *) 0;
+}
 
-   As we don't rely on them, but still need the symbols, we define dummy
-   values here.  */
-void *__exidx_start __attribute__((__visibility__ ("hidden")));
-void *__exidx_end __attribute__((__visibility__ ("hidden")));
 #endif