[-- Attachment #1: Type: text/plain, Size: 1606 bytes --] Hello, Working on the reintroduction of shared libraries support (and of modules depending on shared libraries) exposed a few test failures of simple c++ constructor tests on arm-vxworks7r2. Investigation revealed that we were not linking the crtstuff objects as needed from a compiler configured not to have shared libs support, because of the ENABLE_SHARED_LIBGCC guard in this piece of vxworks.h: /* Setup the crtstuff begin/end we might need for dwarf EH registration and/or INITFINI_ARRAY support for shared libs. */ #if (HAVE_INITFINI_ARRAY_SUPPORT && defined(ENABLE_SHARED_LIBGCC)) \ || (DWARF2_UNWIND_INFO && !defined(CONFIG_SJLJ_EXCEPTIONS)) #define VX_CRTBEGIN_SPEC "%{!shared:vx_crtbegin.o%s;:vx_crtbeginS.o%s}" crtstuff initfini array support is meant to be leveraged for constructors regardless of whether the compiler also happens to be configured with shared library support, so the guard on ENABLE_SHARED_LIBGCC here is inappropriate. This change just removes it, which cured the test c++ contructor test failures we were observing and didn't produce adverse effect on the rest of our builds/runs (gcc-11 based toolchains for vxowkrs7r2 on a variety of architectures). Tested further with a gcc-12 build + basic test cycle on both arm and ppc64 vxworks7r2, as well as ppc vxworks 6.9. Will commit to mainline shortly. Cheers, Olivier 2022-09-30 Olivier Hainque <hainque@adacore.com> gcc/ * config/vxworks.h (VX_CRTBEGIN_SPEC, VX_CRTEND_SPEC): If HAVE_INITFINI_ARRAY_SUPPORT, pick crtstuff objects regardless of ENABLE_SHARED_LIBGCC. [-- Attachment #2: 0005-Refine-INITFINI-condition-for-vxworks-crtstuff-spec.patch --] [-- Type: application/octet-stream, Size: 1826 bytes --] From 6faee7bc168c8cc3fbb57ceeababf00de91c97d8 Mon Sep 17 00:00:00 2001 From: Olivier Hainque <hainque@adacore.com> Date: Thu, 10 Mar 2022 11:02:11 +0000 Subject: [PATCH 05/18] Refine INITFINI condition for vxworks crtstuff spec 2022-03-10 Olivier Hainque <hainque@adacore.com> gcc/ * config/vxworks.h (VX_CRTBEGIN_SPEC, VX_CRTEND_SPEC): If HAVE_INITFINI_ARRAY_SUPPORT, pick crtstuff objects regardless of ENABLE_SHARED_LIBGCC. --- gcc/config/vxworks.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h index 6a5f2f8f2ec..c18a0f65529 100644 --- a/gcc/config/vxworks.h +++ b/gcc/config/vxworks.h @@ -115,7 +115,7 @@ along with GCC; see the file COPYING3. If not see -lc_internal after -lc -lgcc. - libc_internal also contains __init/__fini functions for - USE_INITFINI_ARRAY support. However, the system expects these in + INITFINI_ARRAY support. However, the system expects these in every shared lib as well, with slightly different names, and it is simpler for us to provide our own versions through vxcrtstuff. @@ -220,10 +220,9 @@ along with GCC; see the file COPYING3. If not see #endif /* Setup the crtstuff begin/end we might need for dwarf EH registration - and/or INITFINI_ARRAY support for shared libs. */ - -#if (HAVE_INITFINI_ARRAY_SUPPORT && defined(ENABLE_SHARED_LIBGCC)) \ - || (DWARF2_UNWIND_INFO && !defined(CONFIG_SJLJ_EXCEPTIONS)) + and/or INITFINI_ARRAY support. */ +#if (HAVE_INITFINI_ARRAY_SUPPORT \ + || (DWARF2_UNWIND_INFO && !defined(CONFIG_SJLJ_EXCEPTIONS))) #define VX_CRTBEGIN_SPEC "%{!shared:vx_crtbegin.o%s;:vx_crtbeginS.o%s}" #define VX_CRTEND_SPEC "%{!shared:vx_crtend.o%s;:vx_crtendS.o%s}" #else -- 2.25.1 [-- Attachment #3: Type: text/plain, Size: 2 bytes --]