]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgcc: vxcrtstuff.c: add a few undefs
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 29 Oct 2021 08:10:12 +0000 (10:10 +0200)
committerRasmus Villemoes <rv@rasmusvillemoes.dk>
Tue, 30 Nov 2021 08:05:03 +0000 (09:05 +0100)
commit930e7637828b6c6da7ff33ff3bd20c5c4c9164e7
treeb24eb43b2e39c12ae20ccda214e83f8c82d434e5
parent2acbc4eba33574a5e655c01d1be8b17fad0be535
libgcc: vxcrtstuff.c: add a few undefs

When vxcrtstuff.c was created, the set of #includes was copied from
crtstuff.c. But crtstuff.c also has a bunch of #undefs after the first
#include, because, as the comment says, including auto-host.h when
building objects that are meant for target is technically not
correct.

This manifests when I try do do a canadian cross, with build=linux,
host=windows and target=vxworks, in that we pick up a

  #define caddr_t char *

from auto-host.h, which then of course creates a problem when we later
include a target header that has

  typedef char * caddr_t;

I assume that the #undefs in crtstuff.c have been added for similar
reasons.

These potentially problematic #defines all seem to be guarded by
#ifndef USED_FOR_TARGET, which tconfig.h defines before including
auto-host.h. So at first, it seems that one could avoid the problem
by simply removing the initial include of auto-host.h. Unfortunately,
we do need some of the things defined in auto-host.h within such an
ifndef USED_FOR_TARGET, namely the define of
HAVE_INITFINI_ARRAY_SUPPORT, which is what later causes
initfini-array.h to define USE_INITFINI_ARRAY. So as the next best
fix, just copy the #undefs from crtstuff.c.

libgcc/
* config/vxcrtstuff.c: Undefine caddr_t, pid_t, rlim_t,
ssize_t and vfork after including auto-host.h.
libgcc/config/vxcrtstuff.c