[email protected]
[Top] [All Lists]

Patch to crtstuff.c to undefine some macros after auto-host.h

Subject: Patch to crtstuff.c to undefine some macros after auto-host.h
From: "Joseph S. Myers"
Date: Mon, 14 Nov 2005 16:53:49 +0000 UTC
This patch fixes building a cross-compiler from i686-mingw32 to
arm-none-linux-gnueabi.  auto-host.h contains definitions of gid_t and
uid_t as macros, which cause errors when target system headers are
subsequently included from crtstuff.c.  In principle (bug 21481)
crtstuff.c shouldn't include auto-host.h at all, but in practice (the
patch series

  2005-05-11  Nathan Sidwell  <[email protected]>

        PR bootstrap/21481
        * crtstuff.c: Include auto-host.h again, for now.

  2005-05-10  Nathan Sidwell  <[email protected]>

        * crtstuff.c: Revert part of 2005-05-08 Change.
        (IN_LIBGCC2): Define.

  2005-05-08  Nathan Sidwell  <[email protected]>
            Paolo Bonzini  <[email protected]>

        * Makefile.in (cs-tconfig.h): Pass USED_FOR_TARGET to mkconfig.sh
        * aclocal.m4 (GCC_TARGET_TEMPLATE, AH_TEMPLATE): New.
        * configure.ac (enable_checking): Fix typos in runtime_checking.
        (ENABLE_RUNTIME_CHECKING): Mark as target template.
        (xm_file): Prepend auto-host.h
        (HAVE_GAS_HIDDEN, HAVE_LD_EH_FRAME_HDR): Mark as target template.
        * mkconfig.sh: Do not automatically define USED_FOR_TARGET in
        * crtstuff.c: Do not include auto-host.h.
        (IN_LIBGCC2): Do not define.
        * gcov-io.h: Include tconfig.h, not auto-host.h.
        * libgcc2.c: Do not include auto-host.h.
        (abort): Do not undefine.
        * libgcov.c: Remove unneeded comment about config.h.
        * unwind-dw2-fde-glibc.c: Do not inlude auto-host.h.
        * config.in, configure: Regenerated.

) not including it broke things.  Thus, this patch only undefines the
specific defines of system header symbols, which seem most likely to
cause problems such as those observed.  (An even more conservative fix
would be to undefine only uid_t and gid_t.)

Tested by building a cross-compiler (build = i686-pc-linux-gnu, host =
i686-mingw32, target = arm-none-linux-gnueabi) which was previously
broken.  OK to commit?

2005-11-14  Joseph S. Myers  <[email protected]>

        * crtstuff.c: Undefine gid_t, pid_t, rlim_t, ssize_t, uid_t and
        vfork after including auto-host.h.

diff -rupN GCC.orig/gcc/crtstuff.c GCC/gcc/crtstuff.c
--- GCC.orig/gcc/crtstuff.c     2005-10-28 23:34:11.000000000 +0000
+++ GCC/gcc/crtstuff.c  2005-11-14 15:50:55.000000000 +0000
@@ -58,6 +58,12 @@ Software Foundation, 51 Franklin Street,
    identified the set of defines that need to go into auto-target.h,
    this will have to do.  */
 #include "auto-host.h"
+#undef gid_t
+#undef pid_t
+#undef rlim_t
+#undef ssize_t
+#undef uid_t
+#undef vfork
 #include "tconfig.h"
 #include "tsystem.h"
 #include "coretypes.h"

Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    [email protected] (personal mail)
    [email protected] (CodeSourcery mail)
    [email protected] (Bugzilla assignments and CCs)

<Prev in Thread] Current Thread [Next in Thread>
  • Patch to crtstuff.c to undefine some macros after auto-host.h, Joseph S. Myers <=