[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gdb: FTBFS on hurd-i386 (for review)



Hi!

On Wed, 26 Sep 2012 16:02:29 +0200, Svante Signell <svante.signell@telia.com> wrote:
> gdb does not build from source any longer since gdb-multiarch packages
> was enabled in 7.4.1-1. The build problems are due to two reasons:

I also once had a look and came to the same conclusion.

> First the reserved keyword MACH is defined in include/objcode/h8300.h
> causing problems since gcc defines it for GNU/Hurd. 

Correct.  And I wonder if that isn't a name-space violation?  This is
what I meant to look up when working on this two months ago, but then it
seems I again got distracted by other issues.  Roland, do you have any
comments regarding that?

[GCC]/gcc/config/gnu.h:
    [...]
    #undef GNU_USER_TARGET_OS_CPP_BUILTINS
    #define GNU_USER_TARGET_OS_CPP_BUILTINS()               \
        do {                                        \
            builtin_define ("__gnu_hurd__");        \
            builtin_define ("__GNU__");             \
            builtin_define_std ("unix");            \
            builtin_define_std ("MACH");            \
            builtin_assert ("system=gnu");          \
            builtin_assert ("system=mach");         \
            builtin_assert ("system=unix");         \
            builtin_assert ("system=posix");        \
        } while (0)

    $ gcc -dM -E -x c - < /dev/null | grep -i mach
    #define __MACH 1
    #define __MACH__ 1
    #define MACH 1

Could we/should we remove the latter one?  Though, I have no idea how
much user code is relying on MACH being #defined.  I had a colleague
check, and Apple/Darwin systems do *only* #define __MACH__ (as well as
__APPLE__).

> Secondly, there is a PATH_MAX issue in gdb/nto-tdep.c. [...]

Didn't review that patch yet.

> avoid_MACH_defined_by_gcc.patch:
> --- a/include/opcode/h8300.h    2010-04-15 12:26:09.000000000 +0200
> +++ b/include/opcode/h8300.h    2012-09-26 13:13:57.000000000 +0200
> @@ -25,6 +25,11 @@
>     If the nibble has value 15 or less than the representation is
> complete.
>     Otherwise, we record what it contains with several flags.  */
>  
> +/* Avoid problems under GNU/Hurd */
> +#ifdef MACH
> +#undef MACH
> +#endif
> +
>  typedef int op_type;
>  
>  enum h8_flags

Depending on which conslusion we reach re the above, that might be a
suitable work-around.   The comment should probably be more specific, and
the #undef properly indented: »# undef«.


Grüße,
 Thomas

Attachment: pgpz9hU_sE0SZ.pgp
Description: PGP signature


Reply to: