Browse Source

* ReplaceForbiddenAsmSymbolChars renamed ApplyAsmSymbolRestrictions, because now it also applies the
label length limit

git-svn-id: branches/z80@45085 -

nickysn 5 years ago
parent
commit
3d81dd0b00

+ 2 - 2
compiler/aasmbase.pas

@@ -240,7 +240,7 @@ interface
     function create_smartlink_library:boolean;inline;
     function create_smartlink_library:boolean;inline;
     function create_smartlink:boolean;inline;
     function create_smartlink:boolean;inline;
 
 
-    function ReplaceForbiddenAsmSymbolChars(const s: ansistring): ansistring;
+    function ApplyAsmSymbolRestrictions(const s: ansistring): ansistring;
 
 
     { dummy default noop callback }
     { dummy default noop callback }
     procedure default_global_used;
     procedure default_global_used;
@@ -288,7 +288,7 @@ implementation
       end;
       end;
 
 
 
 
-    function ReplaceForbiddenAsmSymbolChars(const s: ansistring): ansistring;
+    function ApplyAsmSymbolRestrictions(const s: ansistring): ansistring;
       var
       var
         i : longint;
         i : longint;
         rchar: char;
         rchar: char;

+ 29 - 29
compiler/aggas.pas

@@ -873,7 +873,7 @@ implementation
              begin
              begin
                if tai_section(hp).sectype<>sec_none then
                if tai_section(hp).sectype<>sec_none then
                  if replaceforbidden then
                  if replaceforbidden then
-                   WriteSection(tai_section(hp).sectype,ReplaceForbiddenAsmSymbolChars(tai_section(hp).name^),tai_section(hp).secorder,
+                   WriteSection(tai_section(hp).sectype,ApplyAsmSymbolRestrictions(tai_section(hp).name^),tai_section(hp).secorder,
                      tai_section(hp).secalign,tai_section(hp).secflags,tai_section(hp).secprogbits)
                      tai_section(hp).secalign,tai_section(hp).secflags,tai_section(hp).secprogbits)
                  else
                  else
                    WriteSection(tai_section(hp).sectype,tai_section(hp).name^,tai_section(hp).secorder,
                    WriteSection(tai_section(hp).sectype,tai_section(hp).name^,tai_section(hp).secorder,
@@ -925,8 +925,8 @@ implementation
                    if tai_datablock(hp).is_global then
                    if tai_datablock(hp).is_global then
                      begin
                      begin
                        writer.AsmWrite(#9'.globl ');
                        writer.AsmWrite(#9'.globl ');
-                       writer.AsmWriteln(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name));
-                       writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name));
+                       writer.AsmWriteln(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name));
+                       writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name));
                        writer.AsmWriteln(':');
                        writer.AsmWriteln(':');
                        writer.AsmWrite(#9'.space ');
                        writer.AsmWrite(#9'.space ');
                        writer.AsmWriteln(tostr(tai_datablock(hp).size));
                        writer.AsmWriteln(tostr(tai_datablock(hp).size));
@@ -936,7 +936,7 @@ implementation
                    else
                    else
                      begin
                      begin
                        writer.AsmWrite(#9'.lcomm ');
                        writer.AsmWrite(#9'.lcomm ');
-                       writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name));
+                       writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name));
                        writer.AsmWrite(',');
                        writer.AsmWrite(',');
                        writer.AsmWrite(tostr(tai_datablock(hp).size)+',');
                        writer.AsmWrite(tostr(tai_datablock(hp).size)+',');
                        writer.AsmWrite('_data.bss_,');
                        writer.AsmWrite('_data.bss_,');
@@ -956,7 +956,7 @@ implementation
                          begin
                          begin
                            writer.AsmWrite(#9'.comm'#9);
                            writer.AsmWrite(#9'.comm'#9);
                            if replaceforbidden then
                            if replaceforbidden then
-                             writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name))
+                             writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name))
                            else
                            else
                              writer.AsmWrite(tai_datablock(hp).sym.name);
                              writer.AsmWrite(tai_datablock(hp).sym.name);
                            writer.AsmWrite(','+tostr(tai_datablock(hp).size));
                            writer.AsmWrite(','+tostr(tai_datablock(hp).size));
@@ -967,7 +967,7 @@ implementation
                          begin
                          begin
                            writer.AsmWrite(#9'.lcomm'#9);
                            writer.AsmWrite(#9'.lcomm'#9);
                            if replaceforbidden then
                            if replaceforbidden then
-                             writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name));
+                             writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name));
                            else
                            else
                              writer.AsmWrite(tai_datablock(hp).sym.name);
                              writer.AsmWrite(tai_datablock(hp).sym.name);
                            writer.AsmWrite(','+tostr(tai_datablock(hp).size));
                            writer.AsmWrite(','+tostr(tai_datablock(hp).size));
@@ -984,7 +984,7 @@ implementation
                              WriteHiddenSymbol(tai_datablock(hp).sym);
                              WriteHiddenSymbol(tai_datablock(hp).sym);
                            writer.AsmWrite(#9'.globl ');
                            writer.AsmWrite(#9'.globl ');
                            if replaceforbidden then
                            if replaceforbidden then
-                             writer.AsmWriteln(ReplaceForbiddenAsmSymbolChars(Tai_datablock(hp).sym.name))
+                             writer.AsmWriteln(ApplyAsmSymbolRestrictions(Tai_datablock(hp).sym.name))
                            else
                            else
                              writer.AsmWriteln(Tai_datablock(hp).sym.name);
                              writer.AsmWriteln(Tai_datablock(hp).sym.name);
                          end;
                          end;
@@ -995,10 +995,10 @@ implementation
                        if replaceforbidden then
                        if replaceforbidden then
                          begin
                          begin
                            if (tf_needs_symbol_type in target_info.flags) then
                            if (tf_needs_symbol_type in target_info.flags) then
-                             writer.AsmWriteln(#9'.type '+ReplaceForbiddenAsmSymbolChars(Tai_datablock(hp).sym.name)+','+sepChar+'object');
+                             writer.AsmWriteln(#9'.type '+ApplyAsmSymbolRestrictions(Tai_datablock(hp).sym.name)+','+sepChar+'object');
                            if (tf_needs_symbol_size in target_info.flags) and (tai_datablock(hp).size > 0) then
                            if (tf_needs_symbol_size in target_info.flags) and (tai_datablock(hp).size > 0) then
-                              writer.AsmWriteln(#9'.size '+ReplaceForbiddenAsmSymbolChars(Tai_datablock(hp).sym.name)+','+tostr(Tai_datablock(hp).size));
-                           writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(Tai_datablock(hp).sym.name))
+                              writer.AsmWriteln(#9'.size '+ApplyAsmSymbolRestrictions(Tai_datablock(hp).sym.name)+','+tostr(Tai_datablock(hp).size));
+                           writer.AsmWrite(ApplyAsmSymbolRestrictions(Tai_datablock(hp).sym.name))
                          end
                          end
                        else
                        else
                          begin
                          begin
@@ -1198,7 +1198,7 @@ implementation
                                else
                                else
                                  s:=tai_const(hp).sym.name;
                                  s:=tai_const(hp).sym.name;
                                if replaceforbidden then
                                if replaceforbidden then
-                                 s:=ReplaceForbiddenAsmSymbolChars(s);
+                                 s:=ApplyAsmSymbolRestrictions(s);
                                if tai_const(hp).value<>0 then
                                if tai_const(hp).value<>0 then
                                  s:=s+tostr_with_plus(tai_const(hp).value);
                                  s:=s+tostr_with_plus(tai_const(hp).value);
                              end
                              end
@@ -1300,12 +1300,12 @@ implementation
 {$endif arm}
 {$endif arm}
                      writer.AsmWrite('.globl'#9);
                      writer.AsmWrite('.globl'#9);
                      if replaceforbidden then
                      if replaceforbidden then
-                       writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_label(hp).labsym.name))
+                       writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name))
                      else
                      else
                        writer.AsmWriteLn(tai_label(hp).labsym.name);
                        writer.AsmWriteLn(tai_label(hp).labsym.name);
                    end;
                    end;
                   if replaceforbidden then
                   if replaceforbidden then
-                    writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_label(hp).labsym.name))
+                    writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name))
                   else
                   else
                     writer.AsmWrite(tai_label(hp).labsym.name);
                     writer.AsmWrite(tai_label(hp).labsym.name);
                   writer.AsmWriteLn(':');
                   writer.AsmWriteLn(':');
@@ -1323,7 +1323,7 @@ implementation
                 begin
                 begin
                   writer.AsmWrite('.globl'#9);
                   writer.AsmWrite('.globl'#9);
                   if replaceforbidden then
                   if replaceforbidden then
-                    writer.AsmWriteln(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name))
+                    writer.AsmWriteln(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name))
                   else
                   else
                     writer.AsmWriteln(tai_symbol(hp).sym.name);
                     writer.AsmWriteln(tai_symbol(hp).sym.name);
                   if (tai_symbol(hp).sym.bind=AB_PRIVATE_EXTERN) then
                   if (tai_symbol(hp).sym.bind=AB_PRIVATE_EXTERN) then
@@ -1358,14 +1358,14 @@ implementation
                        s:=#9'.llong .';
                        s:=#9'.llong .';
                        ch:='3';
                        ch:='3';
                      end;
                      end;
-                   writer.AsmWriteLn(#9'.csect '+ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name)+'[DS],'+ch);
-                   writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name)+':');
-                   writer.AsmWriteln(s+ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name)+', TOC[tc0], 0');
+                   writer.AsmWriteLn(#9'.csect '+ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name)+'[DS],'+ch);
+                   writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name)+':');
+                   writer.AsmWriteln(s+ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name)+', TOC[tc0], 0');
                    writer.AsmWriteln(#9'.csect .text[PR]');
                    writer.AsmWriteln(#9'.csect .text[PR]');
                    if (tai_symbol(hp).is_global) then
                    if (tai_symbol(hp).is_global) then
-                     writer.AsmWriteLn('.globl .'+ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name))
+                     writer.AsmWriteLn('.globl .'+ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name))
                    else
                    else
-                     writer.AsmWriteLn('.lglobl .'+ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name));
+                     writer.AsmWriteLn('.lglobl .'+ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name));
                    { the dotted name is the name of the actual function entry }
                    { the dotted name is the name of the actual function entry }
                    writer.AsmWrite('.');
                    writer.AsmWrite('.');
                  end
                  end
@@ -1386,9 +1386,9 @@ implementation
                  end;
                  end;
                if replaceforbidden then
                if replaceforbidden then
                  if not(tai_symbol(hp).has_value) then
                  if not(tai_symbol(hp).has_value) then
-                   writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name + ':'))
+                   writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name + ':'))
                  else
                  else
-                   writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name + '=' + tostr(tai_symbol(hp).value)))
+                   writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name + '=' + tostr(tai_symbol(hp).value)))
                else if not(tai_symbol(hp).has_value) then
                else if not(tai_symbol(hp).has_value) then
                  writer.AsmWriteLn(tai_symbol(hp).sym.name + ':')
                  writer.AsmWriteLn(tai_symbol(hp).sym.name + ':')
                else
                else
@@ -1408,13 +1408,13 @@ implementation
                if replaceforbidden then
                if replaceforbidden then
                  begin
                  begin
                    { avoid string truncation }
                    { avoid string truncation }
-                   writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_symbolpair(hp).sym^));
+                   writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_symbolpair(hp).sym^));
                    writer.AsmWrite(s);
                    writer.AsmWrite(s);
-                   writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbolpair(hp).value^));
+                   writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbolpair(hp).value^));
                    if tai_symbolpair(hp).kind=spk_set_global then
                    if tai_symbolpair(hp).kind=spk_set_global then
                      begin
                      begin
                        writer.AsmWrite(#9'.globl ');
                        writer.AsmWrite(#9'.globl ');
-                       writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbolpair(hp).sym^));
+                       writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbolpair(hp).sym^));
                      end;
                      end;
                  end
                  end
                else
                else
@@ -1443,7 +1443,7 @@ implementation
                      (tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
                      (tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
                     writer.AsmWrite('.');
                     writer.AsmWrite('.');
                   if replaceforbidden then
                   if replaceforbidden then
-                    writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_symbol_end(hp).sym.name))
+                    writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_symbol_end(hp).sym.name))
                   else
                   else
                     writer.AsmWrite(tai_symbol_end(hp).sym.name);
                     writer.AsmWrite(tai_symbol_end(hp).sym.name);
                   writer.AsmWrite(', '+s+' - ');
                   writer.AsmWrite(', '+s+' - ');
@@ -1452,7 +1452,7 @@ implementation
                      (tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
                      (tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
                     writer.AsmWrite('.');
                     writer.AsmWrite('.');
                   if replaceforbidden then
                   if replaceforbidden then
-                    writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol_end(hp).sym.name))
+                    writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol_end(hp).sym.name))
                   else
                   else
                     writer.AsmWriteLn(tai_symbol_end(hp).sym.name);
                     writer.AsmWriteLn(tai_symbol_end(hp).sym.name);
                 end;
                 end;
@@ -1527,7 +1527,7 @@ implementation
                if tai_directive(hp).name <>'' then
                if tai_directive(hp).name <>'' then
                  begin
                  begin
                    if replaceforbidden then
                    if replaceforbidden then
-                     writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_directive(hp).name))
+                     writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_directive(hp).name))
                    else
                    else
                      writer.AsmWrite(tai_directive(hp).name);
                      writer.AsmWrite(tai_directive(hp).name);
                  end;
                  end;
@@ -1617,7 +1617,7 @@ implementation
         if asminfo^.dollarsign='$' then
         if asminfo^.dollarsign='$' then
           writer.AsmWriteLn(s.name)
           writer.AsmWriteLn(s.name)
         else
         else
-          writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(s.name))
+          writer.AsmWriteLn(ApplyAsmSymbolRestrictions(s.name))
       end;
       end;
 
 
 
 
@@ -1635,7 +1635,7 @@ implementation
         if asminfo^.dollarsign='$' then
         if asminfo^.dollarsign='$' then
           writer.AsmWriteLn(sym.name)
           writer.AsmWriteLn(sym.name)
         else
         else
-          writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(sym.name))
+          writer.AsmWriteLn(ApplyAsmSymbolRestrictions(sym.name))
       end;
       end;
 
 
 
 

+ 2 - 2
compiler/avr/agavrgas.pas

@@ -122,7 +122,7 @@ unit agavrgas;
               else if assigned(symbol) or (offset<>0) then
               else if assigned(symbol) or (offset<>0) then
                 begin
                 begin
                   if assigned(symbol) then
                   if assigned(symbol) then
-                    s:=ReplaceForbiddenAsmSymbolChars(symbol.name);
+                    s:=ApplyAsmSymbolRestrictions(symbol.name);
 
 
                   if s='' then
                   if s='' then
                     s:=tostr(offset)
                     s:=tostr(offset)
@@ -165,7 +165,7 @@ unit agavrgas;
             top_ref:
             top_ref:
               if o.ref^.refaddr=addr_full then
               if o.ref^.refaddr=addr_full then
                 begin
                 begin
-                  hs:=ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name);
+                  hs:=ApplyAsmSymbolRestrictions(o.ref^.symbol.name);
                   if o.ref^.offset>0 then
                   if o.ref^.offset>0 then
                     hs:=hs+'+'+tostr(o.ref^.offset)
                     hs:=hs+'+'+tostr(o.ref^.offset)
                   else if o.ref^.offset<0 then
                   else if o.ref^.offset<0 then

+ 6 - 6
compiler/dbgstabs.pas

@@ -197,7 +197,7 @@ implementation
       if (Sym.typ=typesym) and (ttypesym(Sym).Fprettyname<>'') then
       if (Sym.typ=typesym) and (ttypesym(Sym).Fprettyname<>'') then
         result:=ttypesym(Sym).FPrettyName;
         result:=ttypesym(Sym).FPrettyName;
       if target_asm.dollarsign<>'$' then
       if target_asm.dollarsign<>'$' then
-        result:=ReplaceForbiddenAsmSymbolChars(result);
+        result:=ApplyAsmSymbolRestrictions(result);
     end;
     end;
 
 
     function GetSymTableName(SymTable : TSymTable) : string;
     function GetSymTableName(SymTable : TSymTable) : string;
@@ -207,7 +207,7 @@ implementation
       else
       else
         result := SymTable.RealName^;
         result := SymTable.RealName^;
       if target_asm.dollarsign<>'$' then
       if target_asm.dollarsign<>'$' then
-        result:=ReplaceForbiddenAsmSymbolChars(result);
+        result:=ApplyAsmSymbolRestrictions(result);
     end;
     end;
 
 
     const
     const
@@ -1190,7 +1190,7 @@ implementation
         if s='name' then
         if s='name' then
           result:=GetSymName(sym)
           result:=GetSymName(sym)
         else if s='mangledname' then
         else if s='mangledname' then
-          result:=ReplaceForbiddenAsmSymbolChars(sym.mangledname)
+          result:=ApplyAsmSymbolRestrictions(sym.mangledname)
         else if s='ownername' then
         else if s='ownername' then
           result:=GetSymTableName(sym.owner)
           result:=GetSymTableName(sym.owner)
         else if s='line' then
         else if s='line' then
@@ -1217,7 +1217,7 @@ implementation
 
 
     function TDebugInfoStabs.staticvarsym_mangled_name(sym: tstaticvarsym): string;
     function TDebugInfoStabs.staticvarsym_mangled_name(sym: tstaticvarsym): string;
       begin
       begin
-        result:=ReplaceForbiddenAsmSymbolChars(sym.mangledname);
+        result:=ApplyAsmSymbolRestrictions(sym.mangledname);
       end;
       end;
 
 
 
 
@@ -1228,7 +1228,7 @@ implementation
            assigned(def.owner.name) then
            assigned(def.owner.name) then
           list.concat(Tai_stab.create_ansistr(stabsdir,ansistring('"vmt_')+GetSymTableName(def.owner)+tobjectdef(def).objname^+':S'+
           list.concat(Tai_stab.create_ansistr(stabsdir,ansistring('"vmt_')+GetSymTableName(def.owner)+tobjectdef(def).objname^+':S'+
                  def_stab_number(vmttype)+'",'+
                  def_stab_number(vmttype)+'",'+
-                 base_stabs_str(globalvarsym_inited_stab,'0','0',ReplaceForbiddenAsmSymbolChars(tobjectdef(def).vmt_mangledname))));
+                 base_stabs_str(globalvarsym_inited_stab,'0','0',ApplyAsmSymbolRestrictions(tobjectdef(def).vmt_mangledname))));
       end;
       end;
 
 
 
 
@@ -1401,7 +1401,7 @@ implementation
                assigned(tprocdef(def.owner.defowner).procsym) then
                assigned(tprocdef(def.owner.defowner).procsym) then
               info := ','+GetSymName(def.procsym)+','+GetSymName(tprocdef(def.owner.defowner).procsym);
               info := ','+GetSymName(def.procsym)+','+GetSymName(tprocdef(def.owner.defowner).procsym);
           end;
           end;
-        mangledname:=ReplaceForbiddenAsmSymbolChars(def.mangledname);
+        mangledname:=ApplyAsmSymbolRestrictions(def.mangledname);
         if target_info.system in systems_dotted_function_names then
         if target_info.system in systems_dotted_function_names then
           mangledname:='.'+mangledname;
           mangledname:='.'+mangledname;
         result.concat(Tai_stab.Create_ansistr(stabsdir,'"'+obj+':'+RType+def_stab_number(def.returndef)+info+'",'+
         result.concat(Tai_stab.Create_ansistr(stabsdir,'"'+obj+':'+RType+def_stab_number(def.returndef)+info+'",'+

+ 4 - 4
compiler/dbgstabx.pas

@@ -95,7 +95,7 @@ implementation
     begin
     begin
       { create reference to the local symbol at the same address as the global
       { create reference to the local symbol at the same address as the global
         symbol (with same name as unmangled symbol, so GDB can find it) }
         symbol (with same name as unmangled symbol, so GDB can find it) }
-      Result:=ReplaceForbiddenAsmSymbolChars(sym.name);
+      Result:=ApplyAsmSymbolRestrictions(sym.name);
     end;
     end;
 
 
 
 
@@ -109,7 +109,7 @@ implementation
              assigned(def.owner.name) then
              assigned(def.owner.name) then
             list.concat(Tai_stab.create_ansistr(stabsdir,ansistring('"vmt_')+GetSymTableName(def.owner)+tobjectdef(def).objname^+':S'+
             list.concat(Tai_stab.create_ansistr(stabsdir,ansistring('"vmt_')+GetSymTableName(def.owner)+tobjectdef(def).objname^+':S'+
                    def_stab_number(vmttype)+'",'+
                    def_stab_number(vmttype)+'",'+
-                   base_stabs_str(globalvarsym_inited_stab,'0','0',ReplaceForbiddenAsmSymbolChars(tobjectdef(def).vmt_mangledname)+'.')));
+                   base_stabs_str(globalvarsym_inited_stab,'0','0',ApplyAsmSymbolRestrictions(tobjectdef(def).vmt_mangledname)+'.')));
         end;
         end;
 *)
 *)
       { do nothing, because creating debug information for a global symbol
       { do nothing, because creating debug information for a global symbol
@@ -193,7 +193,7 @@ implementation
         the place where it is defined }
         the place where it is defined }
       if not assigned(def.procstarttai) then
       if not assigned(def.procstarttai) then
         exit;
         exit;
-      mangledname:=ReplaceForbiddenAsmSymbolChars(def.mangledname);
+      mangledname:=ApplyAsmSymbolRestrictions(def.mangledname);
       if target_info.system in systems_dotted_function_names then
       if target_info.system in systems_dotted_function_names then
         mangledname:='.'+mangledname;
         mangledname:='.'+mangledname;
       result.concat(tai_stab.create(stabx_function,
       result.concat(tai_stab.create(stabx_function,
@@ -254,7 +254,7 @@ implementation
       result:=inherited gen_procdef_endsym_stabs(def);
       result:=inherited gen_procdef_endsym_stabs(def);
       if not assigned(def.procstarttai) then
       if not assigned(def.procstarttai) then
         exit;
         exit;
-      procendsymbol:=current_asmdata.DefineAsmSymbol('LT..'+ReplaceForbiddenAsmSymbolChars(def.mangledname),AB_LOCAL,AT_ADDR,voidpointertype);
+      procendsymbol:=current_asmdata.DefineAsmSymbol('LT..'+ApplyAsmSymbolRestrictions(def.mangledname),AB_LOCAL,AT_ADDR,voidpointertype);
       current_asmdata.asmlists[al_procedures].insertbefore(tai_symbol.create(procendsymbol,0),def.procendtai);
       current_asmdata.asmlists[al_procedures].insertbefore(tai_symbol.create(procendsymbol,0),def.procendtai);
     end;
     end;
 
 

+ 1 - 1
compiler/llvm/agllvm.pas

@@ -1271,7 +1271,7 @@ implementation
                      writer.AsmWriteln(asminfo^.comment+'global/privateextern label: '+tai_label(hp).labsym.name);
                      writer.AsmWriteln(asminfo^.comment+'global/privateextern label: '+tai_label(hp).labsym.name);
                    end;
                    end;
                  if replaceforbidden then
                  if replaceforbidden then
-                   writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_label(hp).labsym.name))
+                   writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name))
                  else
                  else
                    writer.AsmWrite(tai_label(hp).labsym.name);
                    writer.AsmWrite(tai_label(hp).labsym.name);
                  writer.AsmWriteLn(':');
                  writer.AsmWriteLn(':');

+ 5 - 5
compiler/ppcgen/agppcgas.pas

@@ -112,7 +112,7 @@ unit agppcgas;
                    not assigned(symbol) then
                    not assigned(symbol) then
                   internalerror(2011122701);
                   internalerror(2011122701);
                 if asminfo^.dollarsign<>'$' then
                 if asminfo^.dollarsign<>'$' then
-                  getreferencestring:=ReplaceForbiddenAsmSymbolChars(symbol.name)+'('+gas_regname(NR_RTOC)+')'
+                  getreferencestring:=ApplyAsmSymbolRestrictions(symbol.name)+'('+gas_regname(NR_RTOC)+')'
                 else
                 else
                   getreferencestring:=symbol.name+'('+gas_regname(NR_RTOC)+')';
                   getreferencestring:=symbol.name+'('+gas_regname(NR_RTOC)+')';
                 exit;
                 exit;
@@ -128,9 +128,9 @@ unit agppcgas;
                   begin
                   begin
                     if asminfo^.dollarsign<>'$' then
                     if asminfo^.dollarsign<>'$' then
                       begin
                       begin
-                        s:=s+ReplaceForbiddenAsmSymbolChars(symbol.name);
+                        s:=s+ApplyAsmSymbolRestrictions(symbol.name);
                         if assigned(relsymbol) then
                         if assigned(relsymbol) then
-                          s:=s+'-'+ReplaceForbiddenAsmSymbolChars(relsymbol.name)
+                          s:=s+'-'+ApplyAsmSymbolRestrictions(relsymbol.name)
                       end
                       end
                     else
                     else
                       begin
                       begin
@@ -206,7 +206,7 @@ unit agppcgas;
               internalerror(200402267);
               internalerror(200402267);
             hs:=o.ref^.symbol.name;
             hs:=o.ref^.symbol.name;
             if asminfo^.dollarsign<>'$' then
             if asminfo^.dollarsign<>'$' then
-              hs:=ReplaceForbiddenAsmSymbolChars(hs);
+              hs:=ApplyAsmSymbolRestrictions(hs);
             if o.ref^.offset>0 then
             if o.ref^.offset>0 then
               hs:=hs+'+'+tostr(o.ref^.offset)
               hs:=hs+'+'+tostr(o.ref^.offset)
             else
             else
@@ -236,7 +236,7 @@ unit agppcgas;
             begin
             begin
               hs:=o.ref^.symbol.name;
               hs:=o.ref^.symbol.name;
               if asminfo^.dollarsign<>'$' then
               if asminfo^.dollarsign<>'$' then
-                hs:=ReplaceForbiddenAsmSymbolChars(hs);
+                hs:=ApplyAsmSymbolRestrictions(hs);
               if o.ref^.offset>0 then
               if o.ref^.offset>0 then
                hs:=hs+'+'+tostr(o.ref^.offset)
                hs:=hs+'+'+tostr(o.ref^.offset)
               else
               else

+ 2 - 2
compiler/ppcgen/cgppc.pas

@@ -846,7 +846,7 @@ unit cgppc;
                 current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
                 current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
               else
               else
                 current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
                 current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
-              newsymname:=ReplaceForbiddenAsmSymbolChars(symname);
+              newsymname:=ApplyAsmSymbolRestrictions(symname);
               current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_toc_entry,newsymname+'[TC],'+newsymname));
               current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_toc_entry,newsymname+'[TC],'+newsymname));
             end;
             end;
         end
         end
@@ -879,7 +879,7 @@ unit cgppc;
               ref.symbol:=tocsym;
               ref.symbol:=tocsym;
               tocsym.ftocsecnr:=tocnr;
               tocsym.ftocsecnr:=tocnr;
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(tocsym,0));
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(tocsym,0));
-              newsymname:=ReplaceForbiddenAsmSymbolChars(symname);
+              newsymname:=ApplyAsmSymbolRestrictions(symname);
               sym:=current_asmdata.RefAsmSymbol(newsymname,AT_DATA);
               sym:=current_asmdata.RefAsmSymbol(newsymname,AT_DATA);
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_const.Create_sym(sym));
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_const.Create_sym(sym));
             end;
             end;

+ 3 - 3
compiler/riscv/agrvgas.pas

@@ -79,9 +79,9 @@ unit agrvgas;
                   begin
                   begin
                     if asminfo^.dollarsign<>'$' then
                     if asminfo^.dollarsign<>'$' then
                       begin
                       begin
-                        s:=s+ReplaceForbiddenAsmSymbolChars(symbol.name);
+                        s:=s+ApplyAsmSymbolRestrictions(symbol.name);
                         if assigned(relsymbol) then
                         if assigned(relsymbol) then
-                          s:=s+'-'+ReplaceForbiddenAsmSymbolChars(relsymbol.name)
+                          s:=s+'-'+ApplyAsmSymbolRestrictions(relsymbol.name)
                       end
                       end
                     else
                     else
                       begin
                       begin
@@ -159,7 +159,7 @@ unit agrvgas;
             begin
             begin
               hs:=o.ref^.symbol.name;
               hs:=o.ref^.symbol.name;
               if asminfo^.dollarsign<>'$' then
               if asminfo^.dollarsign<>'$' then
-                hs:=ReplaceForbiddenAsmSymbolChars(hs);
+                hs:=ApplyAsmSymbolRestrictions(hs);
               if o.ref^.offset>0 then
               if o.ref^.offset>0 then
                hs:=hs+'+'+tostr(o.ref^.offset)
                hs:=hs+'+'+tostr(o.ref^.offset)
               else
               else

+ 16 - 16
compiler/z80/agsdasz80.pas

@@ -394,9 +394,9 @@ unit agsdasz80;
                       ;
                       ;
                   end;
                   end;
                   if o.ref^.offset<>0 then
                   if o.ref^.offset<>0 then
-                    writer.AsmWrite('('+ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name)+'+'+tostr(o.ref^.offset)+')')
+                    writer.AsmWrite('('+ApplyAsmSymbolRestrictions(o.ref^.symbol.name)+'+'+tostr(o.ref^.offset)+')')
                   else
                   else
-                    writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name));
+                    writer.AsmWrite(ApplyAsmSymbolRestrictions(o.ref^.symbol.name));
                 end
                 end
               else if not assigned(o.ref^.symbol) and
               else if not assigned(o.ref^.symbol) and
                  ((o.ref^.base<>NR_NO) or (o.ref^.index<>NR_NO)) and
                  ((o.ref^.base<>NR_NO) or (o.ref^.index<>NR_NO)) and
@@ -442,7 +442,7 @@ unit agsdasz80;
                         AddSymbol(o.ref^.symbol.name,false);}
                         AddSymbol(o.ref^.symbol.name,false);}
                       if need_plus then
                       if need_plus then
                         writer.AsmWrite('+');
                         writer.AsmWrite('+');
-                      writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name));
+                      writer.AsmWrite(ApplyAsmSymbolRestrictions(o.ref^.symbol.name));
                       need_plus:=true;
                       need_plus:=true;
                     end;
                     end;
                   if o.ref^.offset<>0 then
                   if o.ref^.offset<>0 then
@@ -480,7 +480,7 @@ unit agsdasz80;
                 end
                 end
               else
               else
                 begin
                 begin
-                  writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name));
+                  writer.AsmWrite(ApplyAsmSymbolRestrictions(o.ref^.symbol.name));
                   //if SmartAsm then
                   //if SmartAsm then
                   //  AddSymbol(o.ref^.symbol.name,false);
                   //  AddSymbol(o.ref^.symbol.name,false);
                   if o.ref^.offset>0 then
                   if o.ref^.offset>0 then
@@ -505,7 +505,7 @@ unit agsdasz80;
           begin
           begin
             sym:=TAsmSymbol(current_asmdata.AsmSymbolDict[i]);
             sym:=TAsmSymbol(current_asmdata.AsmSymbolDict[i]);
             if sym.bind in [AB_EXTERNAL,AB_EXTERNAL_INDIRECT] then
             if sym.bind in [AB_EXTERNAL,AB_EXTERNAL_INDIRECT] then
-              writer.AsmWriteln(#9'.globl'#9+ReplaceForbiddenAsmSymbolChars(sym.name));
+              writer.AsmWriteln(#9'.globl'#9+ApplyAsmSymbolRestrictions(sym.name));
           end;
           end;
         writer.AsmWriteln('; End externals');
         writer.AsmWriteln('; End externals');
       end;
       end;
@@ -607,7 +607,7 @@ unit agsdasz80;
               begin
               begin
                 if tai_label(hp).labsym.is_used then
                 if tai_label(hp).labsym.is_used then
                   begin
                   begin
-                    writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_label(hp).labsym.name));
+                    writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name));
                     if tai_label(hp).labsym.bind in [AB_GLOBAL,AB_PRIVATE_EXTERN] then
                     if tai_label(hp).labsym.bind in [AB_GLOBAL,AB_PRIVATE_EXTERN] then
                       writer.AsmWriteLn('::')
                       writer.AsmWriteLn('::')
                     else
                     else
@@ -619,16 +619,16 @@ unit agsdasz80;
                 if not(tai_symbol(hp).has_value) then
                 if not(tai_symbol(hp).has_value) then
                   begin
                   begin
                     if tai_symbol(hp).is_global then
                     if tai_symbol(hp).is_global then
-                      writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name) + '::')
+                      writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name) + '::')
                     else
                     else
-                      writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name) + ':');
+                      writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name) + ':');
                   end
                   end
                 else
                 else
                   begin
                   begin
                     if tai_symbol(hp).is_global then
                     if tai_symbol(hp).is_global then
-                      writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name) + '==' + tostr(tai_symbol(hp).value))
+                      writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name) + '==' + tostr(tai_symbol(hp).value))
                     else
                     else
-                      writer.AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name) + '=' + tostr(tai_symbol(hp).value));
+                      writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name) + '=' + tostr(tai_symbol(hp).value));
                   end;
                   end;
               end;
               end;
             ait_symbol_end :
             ait_symbol_end :
@@ -637,9 +637,9 @@ unit agsdasz80;
             ait_datablock :
             ait_datablock :
               begin
               begin
                 if tai_datablock(hp).is_global or SmartAsm then
                 if tai_datablock(hp).is_global or SmartAsm then
-                  writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name) + '::')
+                  writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name) + '::')
                 else
                 else
-                  writer.AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name) + ':');
+                  writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_datablock(hp).sym.name) + ':');
                 {if SmartAsm then
                 {if SmartAsm then
                   AddSymbol(tai_datablock(hp).sym.name,true);}
                   AddSymbol(tai_datablock(hp).sym.name,true);}
                 writer.AsmWriteLn(#9'.rs'#9+tostr(tai_datablock(hp).size));
                 writer.AsmWriteLn(#9'.rs'#9+tostr(tai_datablock(hp).size));
@@ -666,9 +666,9 @@ unit agsdasz80;
                         if assigned(tai_const(hp).sym) then
                         if assigned(tai_const(hp).sym) then
                           begin
                           begin
                             if assigned(tai_const(hp).endsym) then
                             if assigned(tai_const(hp).endsym) then
-                              s:=ReplaceForbiddenAsmSymbolChars(tai_const(hp).endsym.name)+'-'+ReplaceForbiddenAsmSymbolChars(tai_const(hp).sym.name)
+                              s:=ApplyAsmSymbolRestrictions(tai_const(hp).endsym.name)+'-'+ApplyAsmSymbolRestrictions(tai_const(hp).sym.name)
                             else
                             else
-                              s:=ReplaceForbiddenAsmSymbolChars(tai_const(hp).sym.name);
+                              s:=ApplyAsmSymbolRestrictions(tai_const(hp).sym.name);
                             if tai_const(hp).value<>0 then
                             if tai_const(hp).value<>0 then
                               s:=s+tostr_with_plus(tai_const(hp).value);
                               s:=s+tostr_with_plus(tai_const(hp).value);
                             if consttype in [aitconst_64bit,aitconst_64bit_unaligned] then
                             if consttype in [aitconst_64bit,aitconst_64bit_unaligned] then
@@ -713,9 +713,9 @@ unit agsdasz80;
                         if assigned(tai_const(hp).sym) then
                         if assigned(tai_const(hp).sym) then
                           begin
                           begin
                             if assigned(tai_const(hp).endsym) then
                             if assigned(tai_const(hp).endsym) then
-                              s:=ReplaceForbiddenAsmSymbolChars(tai_const(hp).endsym.name)+'-'+ReplaceForbiddenAsmSymbolChars(tai_const(hp).sym.name)
+                              s:=ApplyAsmSymbolRestrictions(tai_const(hp).endsym.name)+'-'+ApplyAsmSymbolRestrictions(tai_const(hp).sym.name)
                             else
                             else
-                              s:=ReplaceForbiddenAsmSymbolChars(tai_const(hp).sym.name);
+                              s:=ApplyAsmSymbolRestrictions(tai_const(hp).sym.name);
                             if tai_const(hp).value<>0 then
                             if tai_const(hp).value<>0 then
                               s:=s+tostr_with_plus(tai_const(hp).value);
                               s:=s+tostr_with_plus(tai_const(hp).value);
                           end
                           end

+ 2 - 2
compiler/z80/agz80asm.pas

@@ -128,7 +128,7 @@ unit agz80asm;
               else if assigned(symbol) or (offset<>0) then
               else if assigned(symbol) or (offset<>0) then
                 begin
                 begin
                   //if assigned(symbol) then
                   //if assigned(symbol) then
-                  //  s:=ReplaceForbiddenAsmSymbolChars(symbol.name);
+                  //  s:=ApplyAsmSymbolRestrictions(symbol.name);
                   //
                   //
                   //if offset<0 then
                   //if offset<0 then
                   //  s:=s+tostr(offset)
                   //  s:=s+tostr(offset)
@@ -167,7 +167,7 @@ unit agz80asm;
           //  top_ref:
           //  top_ref:
           //    if o.ref^.refaddr=addr_full then
           //    if o.ref^.refaddr=addr_full then
           //      begin
           //      begin
-          //        hs:=ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name);
+          //        hs:=ApplyAsmSymbolRestrictions(o.ref^.symbol.name);
           //        if o.ref^.offset>0 then
           //        if o.ref^.offset>0 then
           //         hs:=hs+'+'+tostr(o.ref^.offset)
           //         hs:=hs+'+'+tostr(o.ref^.offset)
           //        else
           //        else