From patchwork Mon Nov 1 09:34:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 46893 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21DF2385800B for ; Mon, 1 Nov 2021 09:38:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 79F323858422 for ; Mon, 1 Nov 2021 09:35:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79F323858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-x130.google.com with SMTP id bu18so17994865lfb.0 for ; Mon, 01 Nov 2021 02:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UrDDlN6LtirIiR3nEiRwVvtFba3yRRlMVwPLcJ9kNE8=; b=GUj6/rpZcnQTukNom2GbMsBEBedd0N0I+gvsHjsBlMi72opibFxX2H4ytZnHi459MM v+a0y6pm9H23Z0gbQP09KbWb5JhP+EuWiozbU0qL2yji4j9VeHol5F30fjzflEUyViPA e/PG84K1Ry45fxF63Elua1SMJPc+Btwf7H4+s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UrDDlN6LtirIiR3nEiRwVvtFba3yRRlMVwPLcJ9kNE8=; b=bW56tk0mBzwzsfHeKA0nTn/Gg6wBZm1PBYJChhYsvFpZwf7NZAybTQlJyKUIgEBuM9 MeA6aFCRh9WO4ZJFeqKod6f1jYVORmXooZK7oFFZzczsKabcM2H17sxgF1Nk0i9X7aU0 FoUPJvEQrD/RUz8Xjn8NULw392jgmTnSeQ+lr43BP0MpAI25NYcEsqGoo4OoSPaI0n25 yG1JIfjnJhKTwwoz/NSk0/y+0bgpmDzwXw1zP7ZxE0flJypOJ+MvdGJkQ7/2TbGbN3Cu EM0R13HP8rjT3blb8xLarSWsAGl5uXgjnsjbFvJ1Q7+XQase6+4ggp5l2N9tKnw/8AZ/ Ie3Q== X-Gm-Message-State: AOAM532FbqdWFaoyFRNmextzZF8OrtTGIH84Ny4jpV23UFfEukMmXK74 L2jMjMnRTLuA86XWGA28bzCqCg== X-Google-Smtp-Source: ABdhPJyF3tJC/ibH0BN8KsYsYe2Yi2n43+nXjwlWaOF9+z9m8wi2LUPjEU3fV5fsVuwP/fAzJcLYXw== X-Received: by 2002:ac2:42c5:: with SMTP id n5mr26667790lfl.511.1635759347321; Mon, 01 Nov 2021 02:35:47 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id e27sm1045296ljo.5.2021.11.01.02.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:35:46 -0700 (PDT) From: Rasmus Villemoes X-Google-Original-From: Rasmus Villemoes To: Olivier Hainque Subject: [PATCH 4/4] libgcc: vxcrtstuff.c: add a few undefs Date: Mon, 1 Nov 2021 10:34:56 +0100 Message-Id: <20211101093456.2003236-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> References: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gcc-patches@gcc.gnu.org, Rasmus Villemoes Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index 652a65364b0..c15e15e54e9 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"