Browse Source

+ use ApplyAsmSymbolRestrictions on all symbols in the NASM writer

git-svn-id: trunk@45308 -
nickysn 5 years ago
parent
commit
4d428d945e
1 changed files with 15 additions and 15 deletions
  1. 15 15
      compiler/x86/agx86nsm.pas

+ 15 - 15
compiler/x86/agx86nsm.pas

@@ -341,7 +341,7 @@ interface
 {$endif x86_64}
 {$endif x86_64}
            if assigned(symbol) then
            if assigned(symbol) then
             begin
             begin
-              writer.AsmWrite(symbol.name);
+              writer.AsmWrite(ApplyAsmSymbolRestrictions(symbol.name));
               if SmartAsm then
               if SmartAsm then
                 AddSymbol(symbol.name,false);
                 AddSymbol(symbol.name,false);
               first:=false;
               first:=false;
@@ -440,7 +440,7 @@ interface
                    begin
                    begin
                     if SmartAsm then
                     if SmartAsm then
                       AddSymbol(o.ref^.symbol.name,false);
                       AddSymbol(o.ref^.symbol.name,false);
-                    writer.AsmWrite(o.ref^.symbol.name);
+                    writer.AsmWrite(ApplyAsmSymbolRestrictions(o.ref^.symbol.name));
                     if o.ref^.offset=0 then
                     if o.ref^.offset=0 then
                       exit;
                       exit;
                    end;
                    end;
@@ -475,7 +475,7 @@ interface
                    writer.AsmWrite('near ') just disables short branches, increasing code size.
                    writer.AsmWrite('near ') just disables short branches, increasing code size.
                    Omitting it does not cause any bad effects, tested with nasm 2.11. }
                    Omitting it does not cause any bad effects, tested with nasm 2.11. }
 
 
-                writer.AsmWrite(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
@@ -803,7 +803,7 @@ interface
                   if tai_datablock(hp).sym.bind=AB_PRIVATE_EXTERN then
                   if tai_datablock(hp).sym.bind=AB_PRIVATE_EXTERN then
                     WriteHiddenSymbolAttribute(tai_datablock(hp).sym);
                     WriteHiddenSymbolAttribute(tai_datablock(hp).sym);
                 end;
                 end;
-               writer.AsmWrite(PadTabs(tai_datablock(hp).sym.name,':'));
+               writer.AsmWrite(PadTabs(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('RESB'#9+tostr(tai_datablock(hp).size));
                writer.AsmWriteLn('RESB'#9+tostr(tai_datablock(hp).size));
@@ -828,13 +828,13 @@ interface
                        begin
                        begin
                          if SmartAsm then
                          if SmartAsm then
                            AddSymbol(tai_const(hp).sym.name,false);
                            AddSymbol(tai_const(hp).sym.name,false);
-                         writer.AsmWrite(tai_const(hp).sym.name);
+                         writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_const(hp).sym.name));
                          if tai_const(hp).value<>0 then
                          if tai_const(hp).value<>0 then
                            writer.AsmWrite(tostr_with_plus(tai_const(hp).value));
                            writer.AsmWrite(tostr_with_plus(tai_const(hp).value));
                          writer.AsmLn;
                          writer.AsmLn;
                          writer.AsmWrite(ait_const2str[aitconst_16bit]);
                          writer.AsmWrite(ait_const2str[aitconst_16bit]);
                          writer.AsmWrite('SEG ');
                          writer.AsmWrite('SEG ');
-                         writer.AsmWrite(tai_const(hp).sym.name);
+                         writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_const(hp).sym.name));
                        end
                        end
                      else
                      else
                        writer.AsmWrite(tostr(lo(longint(tai_const(hp).value)))+','+
                        writer.AsmWrite(tostr(lo(longint(tai_const(hp).value)))+','+
@@ -849,7 +849,7 @@ interface
                          if SmartAsm then
                          if SmartAsm then
                            AddSymbol(tai_const(hp).sym.name,false);
                            AddSymbol(tai_const(hp).sym.name,false);
                          writer.AsmWrite('SEG ');
                          writer.AsmWrite('SEG ');
-                         writer.AsmWrite(tai_const(hp).sym.name);
+                         writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_const(hp).sym.name));
                        end
                        end
                      else
                      else
                        internalerror(2015110501);
                        internalerror(2015110501);
@@ -888,9 +888,9 @@ interface
                                  AddSymbol(tai_const(hp).endsym.name,false);
                                  AddSymbol(tai_const(hp).endsym.name,false);
                              end;
                              end;
                            if assigned(tai_const(hp).endsym) then
                            if assigned(tai_const(hp).endsym) then
-                             s:=tai_const(hp).endsym.name+'-'+tai_const(hp).sym.name
+                             s:=ApplyAsmSymbolRestrictions(tai_const(hp).endsym.name)+'-'+ApplyAsmSymbolRestrictions(tai_const(hp).sym.name)
                            else
                            else
-                             s:=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
@@ -1002,9 +1002,9 @@ interface
                    if SmartAsm and (tai_label(hp).labsym.bind=AB_GLOBAL) then
                    if SmartAsm and (tai_label(hp).labsym.bind=AB_GLOBAL) then
                      begin
                      begin
                        writer.AsmWrite(#9'GLOBAL ');
                        writer.AsmWrite(#9'GLOBAL ');
-                       writer.AsmWriteLn(tai_label(hp).labsym.name);
+                       writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name));
                      end;
                      end;
-                   writer.AsmWriteLn(tai_label(hp).labsym.name+':');
+                   writer.AsmWriteLn(ApplyAsmSymbolRestrictions(tai_label(hp).labsym.name)+':');
                  end;
                  end;
                if SmartAsm then
                if SmartAsm then
                  AddSymbol(tai_label(hp).labsym.name,true);
                  AddSymbol(tai_label(hp).labsym.name,true);
@@ -1017,11 +1017,11 @@ interface
                if tai_symbol(hp).is_global or SmartAsm then
                if tai_symbol(hp).is_global or SmartAsm then
                 begin
                 begin
                   writer.AsmWrite(#9'GLOBAL ');
                   writer.AsmWrite(#9'GLOBAL ');
-                  writer.AsmWriteLn(tai_symbol(hp).sym.name);
+                  writer.AsmWriteLn(ApplyAsmSymbolRestrictions(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
                     WriteHiddenSymbolAttribute(tai_symbol(hp).sym);
                     WriteHiddenSymbolAttribute(tai_symbol(hp).sym);
                 end;
                 end;
-               writer.AsmWrite(tai_symbol(hp).sym.name);
+               writer.AsmWrite(ApplyAsmSymbolRestrictions(tai_symbol(hp).sym.name));
                if SmartAsm then
                if SmartAsm then
                  AddSymbol(tai_symbol(hp).sym.name,true);
                  AddSymbol(tai_symbol(hp).sym.name,true);
                if (not assigned(hp.next)) or (assigned(hp.next) and not(tai(hp.next).typ in
                if (not assigned(hp.next)) or (assigned(hp.next) and not(tai(hp.next).typ in
@@ -1341,7 +1341,7 @@ interface
           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('EXTERN'#9+sym.name);
+              writer.AsmWriteln('EXTERN'#9+ApplyAsmSymbolRestrictions(sym.name));
           end;
           end;
       end;
       end;
 
 
@@ -1353,7 +1353,7 @@ interface
         while assigned(EC) do
         while assigned(EC) do
           begin
           begin
             if not EC^.is_defined then
             if not EC^.is_defined then
-              writer.AsmWriteln('EXTERN'#9+EC^.psym^);
+              writer.AsmWriteln('EXTERN'#9+ApplyAsmSymbolRestrictions(EC^.psym^));
             EC:=EC^.next;
             EC:=EC^.next;
           end;
           end;
       end;
       end;