This change tightens and documents the use of libc_internal, then strengthens the VxWorks crtstuff objects for the support of shared libraries. In particular: - Define __dso_handle, which libstdc++.so requires, - Provide _init and _fini functions to run through the init/fini arrays for shared libs in configurations which HAVE_INITFINI_ARRAY_SUPPORT. The init/fini functions are provided by libc_internal.a for static links but with slightly different names and we don't want to risk dragging other libc_internal contents in the closure accidentally so make sure we don't link with it. As for the !vxworks crtstuff, the new shared libs specific bits are conditioned by a CRTSTUFFS_O macro, for which we provide new Makefile fragment. The bits to actually use the fragment and the shared objects will be added by a forthcoming change, as part of a more general configury update for shared libs. The change also adds guards the eh table registration code in vxcrtstuff so the objects can be used for either init/fini or eh tables independently. Tested together with the other patches in the current series. Olivier 2021-12-07 Fred Konrad Olivier Hainque gcc/ * config/vxworks.h (VXWORKS_BASE_LIBS_RTP): Guard -lc_internal on !shared+!non-static and document. (VXWORKS_LIB_SPEC): Remove the bits intended to drag the init/fini functions from libc_internal in the shared lib case. (VX_CRTBEGIN_SPEC/VX_CRTEND_SPEC): Use vxcrtstuff objects also in configurations with shared lib and INITFINI_ARRAY support. libgcc/ * config/t-vxcrtstuffS: New Makefile fragment. * config/vxcrtstuff.c: Provide __dso_handle. Provide _init/_fini functions for INITFINI_ARRAY support in shared libs and guard the definition of eh table registration functions on conditions indicating they are needed.