Hello,

This change prepares the ground prior to the reintroduction of
shared libs support for VxWorks.

On this platform, the use of shared libraries involves unusual
steps compared to standard native systems and enforcing static
links by default improves user experience.

This change arranges for the driver to insert a '-static' option by
default for this purpose.

g++ makes choices depending on such options from its
lang_specific_driver, so our default needs to be conveyed before
that and specs aren't handled early enough.

We then proceed by defining a GCC_DRIVER_HOST_INITIALIZATION macro
for VxWorks, to insert a -static option in case the user hasn't provided
any explicit indication on the command line of the kind of link desired.

While a HOST macro doesn't seem appropriate to control a target OS
driven behavior, this matches other uses and won't conflict as VxWorks
is not supported on any of the other configurations using this macro,
and we expect at least warnings if a not a plain failure if a build
with conflicting definitions is attempted.

We have been using this in gcc-11 based production compilers for
a while. I have performed a couple of build+test cycles on gcc-12
for powerpc64-vxworks7r2 and powerpc-vxworks6.9, and did a sanity
checking build of all-gcc for arm-wrs-vxworks7r2.

Cheers,

Olivier

2022-09-29  Marc Poulhies  <poulh...@adacore.com>
            Olivier Hainque  <hain...@adacore.com>

gcc/
        * config/vxwkorks/vxwkorks-driver.cc: New.
        * config.gcc (*vxwkorks*): Add vxworks-driver.o in extra_gcc_objs.
        * config/t-vxworks: Add vxworks-driver.o.
        * config/vxworks.h (GCC_DRIVER_HOST_INITIALIZATION): New.

Attachment: 0016-Define-GCC_DRIVER_HOST_INITIALIZATION-for-VxWorks-ta.patch
Description: Binary data

Reply via email to