Bläddra i källkod

* move ReplaceForbiddenChars to cpubase of avr so it can be used in dbgstabs as well
* tried to fix dbgstabs so that it doesn't emit illegal chars using ReplaceForbiddenChars, however, dbgstabs accesses symbol names quite often, so this failed

git-svn-id: trunk@18972 -

florian 14 år sedan
förälder
incheckning
f1f0cb033a
3 ändrade filer med 21 tillägg och 14 borttagningar
  1. 0 14
      compiler/aggas.pas
  2. 13 0
      compiler/avr/cpubase.pas
  3. 8 0
      compiler/dbgstabs.pas

+ 0 - 14
compiler/aggas.pas

@@ -94,9 +94,6 @@ interface
        end;
        end;
 
 
 
 
-     function ReplaceForbiddenChars(const s: string): string;
-
-
 implementation
 implementation
 
 
     uses
     uses
@@ -201,17 +198,6 @@ implementation
         #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9
         #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9
       );
       );
 
 
-    function ReplaceForbiddenChars(const s: string): string;
-      var
-      i : longint;
-      begin
-        Result:=s;
-        for i:=1 to Length(Result) do
-          if Result[i]='$' then
-            Result[i]:='s';
-      end;
-
-
 {****************************************************************************}
 {****************************************************************************}
 {                          GNU Assembler writer                              }
 {                          GNU Assembler writer                              }
 {****************************************************************************}
 {****************************************************************************}

+ 13 - 0
compiler/avr/cpubase.pas

@@ -315,6 +315,8 @@ unit cpubase;
 
 
     function GetOffsetReg(const r : TRegister;ofs : shortint) : TRegister;
     function GetOffsetReg(const r : TRegister;ofs : shortint) : TRegister;
 
 
+    function ReplaceForbiddenChars(const s: string): string;
+
   implementation
   implementation
 
 
     uses
     uses
@@ -458,4 +460,15 @@ unit cpubase;
         result:=TRegister(longint(r)+ofs);
         result:=TRegister(longint(r)+ofs);
       end;
       end;
 
 
+
+    function ReplaceForbiddenChars(const s: string): string;
+      var
+      i : longint;
+      begin
+        Result:=s;
+        for i:=1 to Length(Result) do
+          if Result[i]='$' then
+            Result[i]:='s';
+      end;
+
 end.
 end.

+ 8 - 0
compiler/dbgstabs.pas

@@ -125,6 +125,10 @@ implementation
         result := Sym.Name
         result := Sym.Name
       else
       else
         result := Sym.RealName;
         result := Sym.RealName;
+{$ifdef avr}
+      if target_asm.id=as_gas then
+        result:=ReplaceForbiddenChars(result);
+{$endif avr}
     end;
     end;
 
 
     function GetSymTableName(SymTable : TSymTable) : string;
     function GetSymTableName(SymTable : TSymTable) : string;
@@ -133,6 +137,10 @@ implementation
         result := SymTable.Name^
         result := SymTable.Name^
       else
       else
         result := SymTable.RealName^;
         result := SymTable.RealName^;
+{$ifdef avr}
+      if target_asm.id=as_gas then
+        result:=ReplaceForbiddenChars(result);
+{$endif avr}
     end;
     end;
 
 
     const
     const