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

Reply via email to