public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183].
@ 2022-12-30 10:06 Iain Sandoe
  2022-12-31 13:31 ` Gaius Mulley
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2022-12-30 10:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: gaiusmod2, ro

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
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-31 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30 10:06 [PATCH 3/n] modula2: Ensure that module registration constructors are 'extern' [PR108183] Iain Sandoe
2022-12-31 13:31 ` Gaius Mulley

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).