Building a powerpc-wrs-vxworks compiler with a very recent mainline
fails with numerous instances or error like:

In file included from 
<prefix>/powerpc-wrs-vxworks/sys-include/types/vxTypesOld.h:123:0,
                 from <build-dir>/gcc/include-fixed/stdint.h:16,
                 from 
<prefix>/powerpc-wrs-vxworks/sys-include/types/vxANSI.h:59,
                 from <build-dir>/gcc/include-fixed/stdio.h:84,
                 from <src-dir>/libgcc/../gcc/tsystem.h:87,
                 from <src-dir>/libgcc/unwind-dw2.c:26:
<prefix>/powerpc-wrs-vxworks/sys-include/base/e_vxTypesOld.h:260:5: error: 
unknown type name 'int8_t'

Note that stdint.h is picked from <build-dir>/gcc/include-fixed.

There are several issues with fixincludes for VxWorks and I'll come to those
later. The one we hit here suggests more generally that the current handling
of stdint.h needs to be improved.

Indeed, the current "hack" (in fixincludes parlance) for stdint on VxWorks has
become incorrect, as it produces a stdint.h file which starts with:

     /* get int*_t, uint*_t */
     #include <types/vxTypes.h>

This doesn't work in general as on the VxWorks end (looking at 6.9),
we apparently have the opposite expectation in types/vxTypes.h, via

  #ifdef _WRS_KERNEL
  #include <types/vxANSI.h>       /* includes kernel's stdint.h */

The proposal here is to remove the fixincludes hack and have gcc provide
stdint.h instead. The attached patch does this by setting use_gcc_stdint to
"provide" in config.gcc and adding vxworks-stdint.h, crafted by looking at
the definitions of the relevant types in headers from a number of VxWorks
installations (version and target variants).

Thanks to Doug Rupp for the in investigation and work involved.


An alternative resolution to the immediate build issue would be to just remove
the fixincludes hack. We are observing numerous testsuite failures afterwards
in this setup, however, as we then rely on the system stdint.h in this case
and it misses at least some macro definitions in some configurations.

This, in principle, should be solvable with alternative fixincludes hacks,
as suggested by https://gcc.gnu.org/ml/gcc/2004-11/msg00254.html.

Getting this right for the wide range of VxWorks variants is tedious and
error prone though, and it seems much simpler to just override consistently
with a gcc provided version.

The proposed patch both fixes the build issues and addresses the shortcomings
of VxWorks' stdint.h that we have observed, curing hundreds of test failures
in our nightly testsuite runs, on both vx6 and vx7.

It also provides a vxworks-stdint.h file, which recent comments on bug 448
suggest was missing. See e.g.

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=448#c31

(Joseph cc'ed).

Nathan, how does this look to you ?

Thanks in advance,

With Kind Regards,

Olivier

2017-06-12  Doug Rupp <r...@adacore.com>

        gcc/
        * config.gcc (*-*-vxworks*): Set use_gcc_stdint to "provide".
        Append vxworks-stdint.h to the tm_file list.
        * config/vxworks-stdint.h: New file.

        fixincludes/
        * inclhack.def (AAB_vxworks_stdint): Remove hack.
        * fixincl.x: Regenerate.

Attachment: vx-stdint.diff
Description: Binary data

Reply via email to