Browse Source

* record in ppu flag whether or not symbols are ansistrings, and use that
flag in ppudump rather than hardcoding targets (it's also the case for
LLVM)

git-svn-id: trunk@42312 -

Jonas Maebe 6 years ago
parent
commit
cc9f8b7f56
3 changed files with 18 additions and 9 deletions
  1. 3 0
      compiler/fppu.pas
  2. 2 1
      compiler/globtype.pas
  3. 13 8
      compiler/utils/ppuutils/ppudump.pp

+ 3 - 0
compiler/fppu.pas

@@ -1021,6 +1021,9 @@ var
 {$ifdef llvm}
         include(moduleflags,mf_llvm);
 {$endif}
+{$ifdef symansistr}
+        include(moduleflags,mf_symansistr);
+{$endif}
 
         old_docrc:=ppufile.do_crc;
         ppufile.do_crc:=false;

+ 2 - 1
compiler/globtype.pas

@@ -377,7 +377,8 @@ interface
          mf_i8086_ss_equals_ds,       { this unit uses an i8086 memory model with SS=DS (i.e. tiny, small or medium) }
          mf_package_deny,             { this unit must not be part of a package }
          mf_package_weak,             { this unit may be completely contained in a package }
-         mf_llvm                      { compiled for LLVM code generator, not compatible with regular compiler because of different nodes in inline functions }
+         mf_llvm,                     { compiled for LLVM code generator, not compatible with regular compiler because of different nodes in inline functions }
+         mf_symansistr                { symbols are ansistrings (for ppudump) }
        );
        tmoduleflags = set of tmoduleflag;
 

+ 13 - 8
compiler/utils/ppuutils/ppudump.pp

@@ -234,6 +234,7 @@ var
   UnitList: TPpuContainerDef;
   CurUnit: TPpuModuleDef;
   SkipVersionCheck: boolean;
+  SymAnsiStr: boolean;
 
 
 {****************************************************************************
@@ -661,6 +662,14 @@ end;
                              Read Routines
 ****************************************************************************}
 
+function readsymstr(ppufile: tppufile): ansistring;
+  begin
+    if not(mf_symansistr in CurUnit.ModuleFlags) then
+      result:=ppufile.getstring
+    else
+      result:=ppufile.getansistring;
+  end;
+
 function readmanagementoperatoroptions(const space : string;const name : string):tmanagementoperators;forward;
 
 procedure readrecsymtableoptions;
@@ -3147,10 +3156,7 @@ begin
              write  ([space,' DefaultConst : ']);
              readderef('');
              if (vo_has_mangledname in varoptions) then
-               if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
-                 writeln([space,'AMangledname : ',getansistring])
-               else
-                 writeln([space,'SMangledname : ',getstring]);
+               writeln([space,'Mangledname : ',readsymstr(ppufile)]);
              if vo_has_section in varoptions then
                writeln(['Section name:',ppufile.getansistring]);
              write  ([space,' FieldVarSymDeref: ']);
@@ -3575,10 +3581,7 @@ begin
              readcommondef('Procedure definition',defoptions,def);
              read_abstract_proc_def(calloption,procoptions,TPpuProcDef(def));
              if (po_has_mangledname in procoptions) then
-               if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
-                 writeln([space,'     Mangled name : ',getansistring])
-               else
-                 writeln([space,'     Mangled name : ',getstring]);
+               writeln([space,'     Mangled name : ',readsymstr(ppufile)]);
              writeln([space,'           Number : ',getword]);
              writeln([space,'            Level : ',getbyte]);
              write  ([space,'            Class : ']);
@@ -4071,6 +4074,8 @@ begin
              CurUnit.LongVersion:=cardinal(getlongint);
              Writeln(['LongVersion: ',CurUnit.LongVersion]);
              getsmallset(CurUnit.ModuleFlags);
+             if mf_symansistr in CurUnit.ModuleFlags then
+               SymAnsiStr:=true;
            end;
 
          ibmodulename :