[3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
Message ID | 20221230100627.14753-1-iain@sandoe.co.uk |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 B21103858C66 for <patchwork@sourceware.org>; Fri, 30 Dec 2022 10:06:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B21103858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672394817; bh=Z1uSEf99LYRIu1CB0Niz1t64ewQq7QiLor3fPm6Wygo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Kh3/jr3dvxWlhePgbLAlK6RSHiBPmsTm7YkHA0VkUDxsmrc9CMrmlWc/NvHJu080n 2wLQnmEIv5YenALauxHJeaAjKKCf3Hz8IrOrCQV1ZABoLS6mAjLzNa834cWsxCtCAH 3+05BUFw9gqWyZmScCIGLTq/LFZb5SQtAMHCVV4g= 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-Google-Smtp-Source: AMrXdXtqf32i5M/f3CdzmhDukxMSOyPTE3gWsXapeqCH4D+aznKtw4gOloZfAbcVQ/JEUnTi9FbJXg== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
|
|
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