Iain Sandoe <iains....@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 <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

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

Reply via email to