build failure on IRIX when building with Python support.
authorJoel Brobecker <brobecker@gnat.com>
Tue, 14 Dec 2010 07:17:15 +0000 (07:17 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 14 Dec 2010 07:17:15 +0000 (07:17 +0000)
commit043b6510015086daf0b084955c4b1da2ee1f0e24
tree16bd79858bfc5818254c30b0b2c8e6ef252f2b2b
parentc4a64778e0c586d49340c9c968ebc722008e4987
build failure on IRIX when building with Python support.

This is a nasty interaction between Python and GDB. Basically,
Python causes some macros to be unilaterally defined in order
to turns some features on:

    /* Define to activate features from IEEE Stds 1003.1-2001 */
    #define _POSIX_C_SOURCE 200112L

    /* Define to the level of X/Open that your system supports */
    #define _XOPEN_SOURCE 600

But the problem is that they turn off defines provided by some
system headers on which we depend. Namely:

  * sys/siginfo.h:

        #if _SGIAPI
        #define siginfo __siginfo
        #endif

  * sys/ucontext.h:

        #if _SGIAPI && !defined(__SGI_NOUCONTEXT_COMPAT)
        [...]
        #define fp_r            __fp_r
        [...]
        #define fp_csr          __fp_csr
        [...]
        #endif

The important macro here is _SGIAPI, defined as follow in standards.h:

        #define _SGIAPI ((defined(_SGI_SOURCE) && \
                                _NO_POSIX && _NO_XOPEN4 && _NO_XOPEN5) || \
                        (_ANSIMODE && _NO_POSIX && _NO_XOPEN4 && _NO_XOPEN5))

If one builds GDB without Python, then _SGIAPI is true, and all is fine.
But building with Python causes both _POSIX_C_SOURCE and _XOPEN_SOURCE
to trip all the _NO_[...] tests (_NO_POSIX, _NO_XOPEN4, _NO_XOPEN5).
And so we get build failures because we try to use undefined types, or
non-existent component names inside the regset structure.

The latter problem is observed only within irix5-nat.c, which means
that it is specific to IRIX.  So it's easy to write the code in a way
that it does not require the macros (just use the real component names,
rather than relying on the macros to do the translation).

The former, on the other hand, is a little trickier, because the problem
occurs inside a generic unit (procfs.c). The solution I chose was to
adjust the configure script to add -Dsiginfo=__siginfo to the CPPFLAGS
if building with python using GCC on IRIX.

We hadn't seen this sort of issue up to now because the affect units
have not been dependent on the python includes up to now.  Recent changes
have made them indirectly dependent on Python, thus triggering the issues.

gdb/ChangeLog:

        * irix5-nat.c: Replace fp_r, fp_regs and fp_scr by __fp_r, __fp_regs
        and __fp_scr respectively throughout.
        * configure.ac: Compile with -Dsiginfo=__siginfo if building with
        Python using GCC on IRIX.
        * configure: Regenerate.
gdb/ChangeLog
gdb/configure
gdb/configure.ac
gdb/irix5-nat.c
This page took 0.026009 seconds and 4 git commands to generate.