From patchwork Wed Apr 12 13:39:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Costas Argyris X-Patchwork-Id: 82505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp333952vqo; Wed, 12 Apr 2023 06:40:24 -0700 (PDT) X-Google-Smtp-Source: AKy350ZMyHyK6ooEbH+pH7Jxtn54VFtVbeLmcxTWkch56vZ7/xyBAbPn20jHdW4lFDysx5venx7L X-Received: by 2002:a50:ee01:0:b0:505:5e8:6641 with SMTP id g1-20020a50ee01000000b0050505e86641mr2017552eds.19.1681306824452; Wed, 12 Apr 2023 06:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681306824; cv=none; d=google.com; s=arc-20160816; b=wvXXSjN930GT8fNOg5iPfV6P0vCFBtd/wZ+inGeTJIMK3yzD0EHCctZWdRr6a51Bm1 3FshBqOsOpVCmgMtpRacOhLy0uAEQBiMHNEPYAIheRR32JFm7BUjJXVFluqsIfj2xiH6 bZqh4b+vP5WGW12OwD/OOsxPkV+tTRcvlo5axNJJM/mE9jgwGa6JVQ2Sj2Filzl/x2s8 nTY+cd4zyV2dv40gVh0PoJTCIWtTwgcyS3g0wQkHEC9Y1mSoT2bUA0+VSTJHPOHARZz0 l1kBd7V6hRvGdXrCr+uyEIB8E6bJNpXQWir8u4xv+VQT4+2+SLSOfCVLb6sgiX+6ira9 Nu8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:cc:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=OhpB4uwY5yYQ4uYoowcsbsAHzN3jMiVZi+6abCP1oM8=; b=KKSJZVD5RV2JVZ9jdNrEg8hL1jwh6+aSVHZ9bHrkLXTnOet+Ucyhr7DEpVJORapott T6TVKASVw8w1qP12yA8YXihBiJ1BYco5sWJ6/zaw8dnugvLViurpersScQGORxBJcEQx ru0r0vWjbCH+SApWt4uS2LHmGcQ+5E/s9dHAU1OHh51Sdd7uiSMVMwtm83tz6teZhYqN 0r2E8PHQ65mqBbXaEtj4udtwFzVjarJ5+A4b79M6BjZdkQiG7qYCWzSyK3REshlOixTi SZqmR3k1h2d7XAeBM4HFPej8kkeybwmWCzvrIHWO7W+wr/1n3BDXElVh45iVr4R5Jh7K rI+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="dI1c/TdR"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r17-20020a056402035100b004ab1c20c759si9695355edw.543.2023.04.12.06.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 06:40:24 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="dI1c/TdR"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 220F8385842B for ; Wed, 12 Apr 2023 13:40:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 220F8385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681306823; bh=OhpB4uwY5yYQ4uYoowcsbsAHzN3jMiVZi+6abCP1oM8=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=dI1c/TdRZVoB1zco91Ed07Qjk7xfVa55/imp2tFjueyzrAk2hCD8ztJNUlGuP5fcB KQkHYgdn1k3f4+WOvmMNAHKwsKPxgDDDJSIAG9j8+4JnZ8ZGerLSUEnwB6lstpK4a7 RWcZ5dm1PSlLum/+HvlU4adGVdwmbrM+Wii6clsI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id CB59C3858D28 for ; Wed, 12 Apr 2023 13:39:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB59C3858D28 Received: by mail-ej1-x62e.google.com with SMTP id j17so19286396ejs.5 for ; Wed, 12 Apr 2023 06:39:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681306778; x=1683898778; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jgzVep4MM/kc4Nggp2jbRGppOAVsZsCCfLcIoEvrTQI=; b=XlUiX1mTkpQgOlw82LlIeSh9pDujVNI6TUHhECTkplA38LtPrN9Jtt8aWtYIqehv9a Eu25xvoon9openFS1E619bQpHgpFvcsvDxC/umo691Ita23aNntQHiOivb1nNbeI/ZbA qkpdnzswH1U2VHYau0gGEGKOkTPdEnVEBUiXz/47e4ImG+8YBqh8UM/zRRTJzdBJ5F8r l+U+y/cvpcQgtxaE61nAQFE/MNIKqhQIJbMKIRp5D07BERgruMkXaocT0ZJ2S9ji/q6v OT4XCbBzWu0mldSOiRD8IIDBXMpZ7ppURyi81s5Rg98esuVatajXGa2+FuLRd6A2cgK2 Nb1w== X-Gm-Message-State: AAQBX9fXrAFVTeyrEr7m/ABiu8uI4vWLKJIxr7U/eZGc9oGEoXBnEuVe wn72G1LmECmuYCK9zOjPNrJDA26Ju6YZ+H+tgYlp/9DFzkQ5Pw== X-Received: by 2002:a17:907:c29:b0:8b1:3298:c587 with SMTP id ga41-20020a1709070c2900b008b13298c587mr7720633ejc.2.1681306778018; Wed, 12 Apr 2023 06:39:38 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 12 Apr 2023 14:39:26 +0100 Message-ID: Subject: [PATCH] mingw: Support building with older gcc versions To: gcc-patches@gcc.gnu.org Cc: Jonathan Yong <10walls@gmail.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: , X-Patchwork-Original-From: Costas Argyris via Gcc-patches From: Costas Argyris Reply-To: Costas Argyris Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762977984589078139?= X-GMAIL-MSGID: =?utf-8?q?1762977984589078139?= This is proposed to fix PR109460 where an older version of gcc (7.3) was used to build for windows (mingw) host. From e5b608072f80a83cca65e88bb75ecc62ab0bbb87 Mon Sep 17 00:00:00 2001 From: Costas Argyris Date: Wed, 12 Apr 2023 08:48:18 +0100 Subject: [PATCH] mingw: Support building with older gcc versions The $@ argument to the compiler is causing only a warning in some gcc versions but an error in others. In any case, $@ was never necessary so remove it completely, just like the rules in x-mingw32 where the object file gets named after the source file. This fixes both warnings and errors about sym-mingw32.o appearing in the command line unnecessarily. The -nostdlib flag is required along with -r for older gcc versions that don't apply it automatically with -r, resulting in main functions erroneously entering a partial link. --- gcc/config/i386/x-mingw32-utf8 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/x-mingw32-utf8 b/gcc/config/i386/x-mingw32-utf8 index 2783dd259a6..b5a6cfcf702 100644 --- a/gcc/config/i386/x-mingw32-utf8 +++ b/gcc/config/i386/x-mingw32-utf8 @@ -34,7 +34,7 @@ utf8rc-mingw32.o : $(srcdir)/config/i386/utf8-mingw32.rc \ # Create an object file that just exports the global symbol # HOST_EXTRA_OBJS_SYMBOL sym-mingw32.o : $(srcdir)/config/i386/sym-mingw32.cc - $(COMPILER) -c $< $@ + $(COMPILER) -c $< # Combine the two object files into one which has both the # compiled utf8 resource and the HOST_EXTRA_OBJS_SYMBOL symbol. @@ -44,8 +44,10 @@ sym-mingw32.o : $(srcdir)/config/i386/sym-mingw32.cc # If nothing references it into libbackend.a, it will not # get linked into the compiler proper eventually. # Therefore we need to request the symbol at compiler link time. +# -nostdlib is required for supporting old gcc versions that +# don't apply it automatically with -r. utf8-mingw32.o : utf8rc-mingw32.o sym-mingw32.o - $(COMPILER) -r utf8rc-mingw32.o sym-mingw32.o -o $@ + $(COMPILER) -r -nostdlib utf8rc-mingw32.o sym-mingw32.o -o $@ # Force compilers to link against the utf8 resource by # requiring the symbol to be defined. -- 2.30.2