public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Rasmus Villemoes <villemoes@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5592] libgcc: vxcrtstuff.c: add a few undefs Date: Tue, 30 Nov 2021 08:05:32 +0000 (GMT) [thread overview] Message-ID: <20211130080532.2D2043857C7E@sourceware.org> (raw) https://gcc.gnu.org/g:930e7637828b6c6da7ff33ff3bd20c5c4c9164e7 commit r12-5592-g930e7637828b6c6da7ff33ff3bd20c5c4c9164e7 Author: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Date: Fri Oct 29 10:10:12 2021 +0200 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. Diff: --- libgcc/config/vxcrtstuff.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index 87fadda9ac5..767b9de577d 100644 --- a/libgcc/config/vxcrtstuff.c +++ b/libgcc/config/vxcrtstuff.c @@ -26,7 +26,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define IN_LIBGCC2 +/* FIXME: Including auto-host is incorrect, but until we have + identified the set of defines that need to go into auto-target.h, + this will have to do. */ #include "auto-host.h" +#undef caddr_t +#undef pid_t +#undef rlim_t +#undef ssize_t +#undef vfork #include "tconfig.h" #include "tsystem.h" #include "coretypes.h"
reply other threads:[~2021-11-30 8:05 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211130080532.2D2043857C7E@sourceware.org \ --to=villemoes@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).