From 27204060db51ed0637e394dff387c66c6b944726 Mon Sep 17 00:00:00 2001 From: Jerome Lambourg Date: Thu, 14 Nov 2019 16:11:30 +0000 Subject: Update the arm-*-vxworks* support 2019-11-13 Jerome Lambourg Doug Rupp Olivier Hainque 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 Co-Authored-By: Olivier Hainque From-SVN: r278253 --- libgcc/ChangeLog | 11 ++++++ libgcc/config.host | 16 +++------ libgcc/config/arm/unwind-arm-vxworks.c | 65 ++++++++++++++++++++++++++++------ 3 files changed, 71 insertions(+), 21 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index dfb30a6..dfc842d 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,14 @@ +2019-11-14 Jerome Lambourg + Doug Rupp + Olivier Hainque + + * 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 Olivier Hainque diff --git a/libgcc/config.host b/libgcc/config.host index 1c8d63b..3035168 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -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" diff --git a/libgcc/config/arm/unwind-arm-vxworks.c b/libgcc/config/arm/unwind-arm-vxworks.c index 03d753d..6fccf10 100644 --- a/libgcc/config/arm/unwind-arm-vxworks.c +++ b/libgcc/config/arm/unwind-arm-vxworks.c @@ -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 @@ -20,14 +20,59 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#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 + +/* __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 -- cgit v1.1