public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6726] [modula2] Bugfix local symbol names for -fm2-whole-program
@ 2023-03-17  0:23 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2023-03-17  0:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6bf80413deb5c1eacbefd685e106c6351b75ecf2

commit r13-6726-g6bf80413deb5c1eacbefd685e106c6351b75ecf2
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Fri Mar 17 00:23:02 2023 +0000

    [modula2] Bugfix local symbol names for -fm2-whole-program
    
    Local symbols must be prefixed by the modulename if
    -fm2-whole-program is used to avoid a name clash.
    
    gcc/m2/ChangeLog:
    
            * gm2-compiler/M2AsmUtil.mod (SymNeedsModulePrefix):
            Re-implemented.
            * gm2-libs/SysStorage.mod (enableTrace): Disable tracing.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/gm2-compiler/M2AsmUtil.mod | 28 +++++++++++++---------------
 gcc/m2/gm2-libs/SysStorage.mod    |  2 +-
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2AsmUtil.mod b/gcc/m2/gm2-compiler/M2AsmUtil.mod
index 85bbceba3ea..9ee5dd35df7 100644
--- a/gcc/m2/gm2-compiler/M2AsmUtil.mod
+++ b/gcc/m2/gm2-compiler/M2AsmUtil.mod
@@ -40,7 +40,7 @@ FROM SymbolTable IMPORT NulSym,
                         IsProcedure,
                         IsModule,
                         IsDefImp,
-                        IsExportQualified,
+                        IsExportQualified, IsExportUnQualified,
                         IsExported, IsPublic, IsExtern, IsMonoName,
                         IsDefinitionForC ;
 
@@ -146,28 +146,26 @@ END GetFullSymName ;
 
 
 (*
-   SymNeedsModulePrefix -
+   SymNeedsModulePrefix - return TRUE if symbol mod is required to have a prefix.
 *)
 
 PROCEDURE SymNeedsModulePrefix (sym, mod: CARDINAL) : BOOLEAN ;
 BEGIN
-   IF IsDefImp(mod)
+   IF IsDefImp (mod)
    THEN
-      IF WholeProgram
+      IF IsExportUnQualified (sym)
       THEN
-         IF NOT IsDefinitionForC(mod)
-         THEN
-            RETURN( TRUE )
-         END
-      ELSIF IsExportQualified(sym)
-      THEN
-         RETURN( TRUE )
+         RETURN FALSE
+      ELSE
+         (* We need to force the prefix if whole program is used otherwise
+            local symbols from multipl modules might conflict.  *)
+         RETURN WholeProgram OR IsExportQualified (sym)
       END
-   ELSIF IsModule(mod)
+   ELSIF IsModule (mod)
    THEN
-      RETURN( WholeProgram )
+      RETURN WholeProgram
    END ;
-   RETURN( FALSE )
+   RETURN FALSE
 END SymNeedsModulePrefix ;
 
 
@@ -185,7 +183,7 @@ BEGIN
       THEN
          RETURN( ConCat(ConCatChar(InitStringCharStar(KeyToCharStar(GetSymName(ModSym))), '_'),
                         GetModulePrefix(Name, ModSym, GetScope(ModSym))) )
-      ELSIF SymNeedsModulePrefix(Sym, ModSym)
+      ELSIF SymNeedsModulePrefix (Sym, ModSym)
       THEN
          RETURN( ConCatChar(ConCat(InitStringCharStar(KeyToCharStar(GetSymName(ModSym))), Mark(Name)), '_') )
       END
diff --git a/gcc/m2/gm2-libs/SysStorage.mod b/gcc/m2/gm2-libs/SysStorage.mod
index 2277f93a398..2318ab7a6c5 100644
--- a/gcc/m2/gm2-libs/SysStorage.mod
+++ b/gcc/m2/gm2-libs/SysStorage.mod
@@ -34,7 +34,7 @@ FROM SYSTEM IMPORT ADR ;
 CONST
    enableDeallocation =  TRUE ;
    enableZero         =  TRUE ;
-   enableTrace        =  TRUE ;
+   enableTrace        =  FALSE ;
 
 VAR
    callno: CARDINAL ;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-17  0:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  0:23 [gcc r13-6726] [modula2] Bugfix local symbol names for -fm2-whole-program 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).