[3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
Message ID | 20221230100627.14753-1-iain@sandoe.co.uk |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2817915wrt; Fri, 30 Dec 2022 02:07:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXvSq/0djTlOa4ogxSjTIPKbP2wWmG/vxi+F+w6VPhkcevYl81FvK/m+224vdU/YZ4Filv6W X-Received: by 2002:a05:6402:88d:b0:467:956b:1610 with SMTP id e13-20020a056402088d00b00467956b1610mr26311515edy.0.1672394833624; Fri, 30 Dec 2022 02:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672394833; cv=none; d=google.com; s=arc-20160816; b=itVB89kdpuPgqZJ8j9b8XKIHpJsOGnPKtIH1v/HGg2be4XrUBp7gkma3p36xAv93DU Q27ECK2reWSlqqS4pKX2aciVyZZSl7GMUNiq8QEstV1wRkm+FcpuqKutGyM/FWsbqnpc d2D7ZeEa2HkPQPmeuNEO3HqJxvf9DAQPRvXEM/2X+6gljD22YFr6E7Vdwr4aD3SJg91h 6CpTF0Eeox+NmgK73R3F8ZiyxVg560x7Jrf1Pc1UozHK0SCzXtJ5N/EZpz2LeQiwjS2/ laPz2yr8qPLIDuvvG4BIogKJtsHvqzKdVP1e9YR5bE9Rl2zECyY/2SGE3JkjDrUUeq/Q 1UYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :delivered-to:dkim-signature:dkim-filter; bh=Z1uSEf99LYRIu1CB0Niz1t64ewQq7QiLor3fPm6Wygo=; b=scnDkuud0iqLRE8BtA8B0GqI2KXukyh8KyNbY+yQxVlgbWd2tF9MImRyTOhp33p9dH BAAaVKTCS69pyvejLnBwopzXylGnvN5GMqLBUpeTV6dnRA0cnViRkVATvp93hGOFc7XX G1NhckNg7KC9JujI01gpqLvps7alo6fwy5XkBjtGoMbeIuFDa4pTSvyJ+uMbypmEd3x/ ipSAY/nShNMdYDHcApXDeXBsUAHAt/cNfw7CtE7JtVH4lx+fNF0RaeC3pZB3fpb9BKvO Mdiaq1ziNmb6xEQunGOuZWvm4BM2p9JbxdjM2aVubXUVJl8Ec4V3Fp2Hfv1rst4ycEPQ YAdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ba8zGCIC; 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 f2-20020a05640214c200b0046dc78b47e9si15489018edx.173.2022.12.30.02.07.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 02:07:13 -0800 (PST) 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=Ba8zGCIC; 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 6A9493858C30 for <ouuuleilei@gmail.com>; Fri, 30 Dec 2022 10:07:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A9493858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672394832; bh=Z1uSEf99LYRIu1CB0Niz1t64ewQq7QiLor3fPm6Wygo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Ba8zGCICvm5hUqfcFaeAZAZCCydPKB16KGyIi9ZSKZD17MnTg6elEsa9KP4/qiWvi Rz0itHc9kfWSdY+LL3uR3HugTwON091R1vl8n4tnVfqPnzkVj6S2M1nb5QSPliPVzn m7DPd6oKiwJsNLe7q6+KzSdsGYqbcam2xSC1vtL0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 2D9633858C66 for <gcc-patches@gcc.gnu.org>; Fri, 30 Dec 2022 10:06:30 +0000 (GMT) Received: by mail-wm1-x335.google.com with SMTP id ay40so14880104wmb.2 for <gcc-patches@gcc.gnu.org>; Fri, 30 Dec 2022 02:06:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z1uSEf99LYRIu1CB0Niz1t64ewQq7QiLor3fPm6Wygo=; b=zRE5fdxt7Mj/1rkP1R/zz4Ro/DQ3q8X54JE66KjhYGS2X3mTxB9RAk0640nZTjvd9l mEMsqBkhsckJ6/+HRqPfwrH4jfQ19PLcKU2NjR+U2djsaTYOwlk7jcSyoQaXxKaNyx6J vqiRUruljjF4oXh5p7MbTfbRQvnuyJ8cNnVX6iTLuZeFzJ/tNY6eN8kD1Nttup/R/Aex /OxC2eJ6ssYs/IiXLuozMy0ne5qVXrl9JvCCjabzJDcWNDgAOhphV8giECj16wNmVxP2 B53+S+mMo1+jFZTH2wc/fL7cWaCQTblPg0OiG6bduBXkh+cJZlu2NZOGow4rT0Bc3UZD 0vKQ== X-Gm-Message-State: AFqh2krR7EIq8SgWnAQ+X4Y3f52wL3DhkXMtI0zd+Kj3ik+IABtGQ50w rLa5HDXpDmw0+vTbRtNen35buY+f0LY= X-Received: by 2002:a05:600c:35d4:b0:3d2:2d2a:d581 with SMTP id r20-20020a05600c35d400b003d22d2ad581mr21784879wmq.30.1672394788837; Fri, 30 Dec 2022 02:06:28 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id d22-20020a1c7316000000b003d9862ec435sm14539593wmb.20.2022.12.30.02.06.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 30 Dec 2022 02:06:28 -0800 (PST) X-Google-Original-From: Iain Sandoe <iain@sandoe.co.uk> To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183]. Date: Fri, 30 Dec 2022 10:06:27 +0000 Message-Id: <20221230100627.14753-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Iain Sandoe via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe <iains.gcc@gmail.com>, gaiusmod2@gmail.com, ro@CeBiTec.Uni-Bielefeld.DE Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753633084858822555?= X-GMAIL-MSGID: =?utf-8?q?1753633084858822555?= |
Series |
[3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Iain Sandoe
Dec. 30, 2022, 10:06 a.m. UTC
There are several modula-2 issues on Darwin, some blocking bootstrap on
one or more system versions.
This has been tested on powerpc/i688-darwin9 .. x86_64-darwin10,17,21 and
the prototype aarch64-darwin branch on darwin21.
OK for trunk?
thanks
Iain
NOTE: As discussed in the PR, there are likely to be other changes to the
_definitions_ of the module registration constructors. This patch only
relates to the _references_ to those CTORs.
--- 8< ---
The symbols for module registration constructors need to be external
or we get wrong code generated for targets that allow direct access to
local symbol definitions.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108183
gcc/m2/ChangeLog:
* gm2-compiler/M2GCCDeclare.mod: Module registration constructors are
externs to the builder of m2_link.
---
gcc/m2/gm2-compiler/M2GCCDeclare.mod | 5 +++++
1 file changed, 5 insertions(+)
Comments
Iain Sandoe <iains.gcc@gmail.com> writes: > There are several modula-2 issues on Darwin, some blocking bootstrap on > one or more system versions. > > This has been tested on powerpc/i688-darwin9 .. x86_64-darwin10,17,21 and > the prototype aarch64-darwin branch on darwin21. > > OK for trunk? > thanks > Iain > > NOTE: As discussed in the PR, there are likely to be other changes to the > _definitions_ of the module registration constructors. This patch only > relates to the _references_ to those CTORs. > > --- 8< --- > > The symbols for module registration constructors need to be external > or we get wrong code generated for targets that allow direct access to > local symbol definitions. > > Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> > > PR modula2/108183 > > gcc/m2/ChangeLog: > > * gm2-compiler/M2GCCDeclare.mod: Module registration constructors are > externs to the builder of m2_link. > --- > gcc/m2/gm2-compiler/M2GCCDeclare.mod | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod > index 7e814b631ee..4c177c47398 100644 > --- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod > +++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod > @@ -2294,6 +2294,11 @@ PROCEDURE IsExternal (sym: CARDINAL) : BOOLEAN ; > VAR > mod: CARDINAL ; > BEGIN > + IF IsProcedure (sym) AND IsExtern (sym) > + THEN > + Assert (NOT IsDefImp (sym)); > + RETURN TRUE > + END ; > mod := GetScope(sym) ; > REPEAT > IF mod=NulSym a very minor change suggested: VAR mod: CARDINAL ; BEGIN Assert (NOT IsDefImp (sym)) ; IF IsProcedure (sym) AND IsExtern (sym) THEN RETURN TRUE END ; mod := GetScope(sym) ; REPEAT IF mod=NulSym as it doesn't make sense to call GetScope from a DefImp symbol. There is no entry in the double booking tree for DefImp symbols (definition / implmentation modules) - so it really shouldn't occur. Other than this obvious change, the patches 1, 2, 3 LGTM - I've also boot strapped and built these patches (with the above Assert change) on amd64 gnu/linux for what it is worth, regards, Gaius
diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod index 7e814b631ee..4c177c47398 100644 --- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod +++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod @@ -2294,6 +2294,11 @@ PROCEDURE IsExternal (sym: CARDINAL) : BOOLEAN ; VAR mod: CARDINAL ; BEGIN + IF IsProcedure (sym) AND IsExtern (sym) + THEN + Assert (NOT IsDefImp (sym)); + RETURN TRUE + END ; mod := GetScope(sym) ; REPEAT IF mod=NulSym