From: Gaius Mulley <gaiusmod2@gmail.com>
To: Iain Sandoe <iains.gcc@gmail.com>
Cc: gcc-patches@gcc.gnu.org, iain@sandoe.co.uk,
ro@CeBiTec.Uni-Bielefeld.DE
Subject: Re: [PATCH 3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
Date: Sat, 31 Dec 2022 13:31:43 +0000 [thread overview]
Message-ID: <871qofya0w.fsf@debian> (raw)
In-Reply-To: <20221230100627.14753-1-iain@sandoe.co.uk> (Iain Sandoe's message of "Fri, 30 Dec 2022 10:06:27 +0000")
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
prev parent reply other threads:[~2022-12-31 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 10:06 Iain Sandoe
2022-12-31 13:31 ` Gaius Mulley [this message]
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=871qofya0w.fsf@debian \
--to=gaiusmod2@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iain@sandoe.co.uk \
--cc=iains.gcc@gmail.com \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/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: link
Be 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).