From: Iain Sandoe Date: Wed, 21 Dec 2022 09:05:32 +0000 (+0000) Subject: modula2: Ensure that module registration constructors are 'extern' [PR108183]. X-Git-Tag: basepoints/gcc-14~2264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d423e8dc59045d8f281dcb1a02559cb6f91456bf;p=thirdparty%2Fgcc.git modula2: Ensure that module registration constructors are 'extern' [PR108183]. 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 PR modula2/108183 gcc/m2/ChangeLog: * gm2-compiler/M2GCCDeclare.mod: Module registration constructors are externs to the builder of m2_link. Co-Authored-By: Gaius Mulley --- diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod index 7e814b631eed..d784fbc40de2 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 + Assert (NOT IsDefImp (sym)) ; + IF IsProcedure (sym) AND IsExtern (sym) + THEN + RETURN TRUE + END ; mod := GetScope(sym) ; REPEAT IF mod=NulSym