2
0
Эх сурвалжийг харах

* split newasmsymbol to refasmsymbol and defineasmsymbol

git-svn-id: trunk@3057 -
peter 19 жил өмнө
parent
commit
0ec2921bbe

+ 27 - 27
compiler/aasmdata.pas

@@ -128,9 +128,9 @@ interface
         constructor create(const n:string);
         constructor create(const n:string);
         destructor  destroy;override;
         destructor  destroy;override;
         { asmsymbol }
         { asmsymbol }
-        function  newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:TAsmsymtype) : tasmsymbol;
+        function  DefineAsmSymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
+        function  RefAsmSymbol(const s : string) : tasmsymbol;
         function  getasmsymbol(const s : string) : tasmsymbol;
         function  getasmsymbol(const s : string) : tasmsymbol;
-        function  newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel;
         { create new assembler label }
         { create new assembler label }
         procedure getlabel(var l : tasmlabel;alt:tasmlabeltype);
         procedure getlabel(var l : tasmlabel;alt:tasmlabeltype);
         procedure getjumplabel(var l : tasmlabel);
         procedure getjumplabel(var l : tasmlabel);
@@ -315,25 +315,23 @@ implementation
       end;
       end;
 
 
 
 
-    function TAsmData.newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
+    function TAsmData.DefineAsmSymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
         hp:=tasmsymbol(FAsmSymbolDict.search(s));
         hp:=tasmsymbol(FAsmSymbolDict.search(s));
         if assigned(hp) then
         if assigned(hp) then
          begin
          begin
-           {$IFDEF EXTDEBUG}
-           if (_typ <> AT_NONE) and
-              (hp.typ <> _typ) and
-              not(cs_compilesystem in aktmoduleswitches) and
-              (target_info.system <> system_powerpc_darwin) then
+           { Redefine is allowed, but the types must be the same. The redefine
+             is needed for Darwin where the labels are first allocated }
+           if (hp.bind<>AB_EXTERNAL) then
              begin
              begin
-               //Writeln('Error symbol '+hp.name+' type is ',Ord(_typ),', should be ',Ord(hp.typ));
-               InternalError(2004031501);
+               if (hp.bind<>_bind) and
+                  (hp.typ<>_typ) then
+                 internalerror(200603261);
              end;
              end;
-           {$ENDIF}
-           if (_bind<>AB_EXTERNAL) then
-             hp.bind:=_bind
+           hp.typ:=_typ;
+           hp.bind:=_bind;
          end
          end
         else
         else
          begin
          begin
@@ -341,7 +339,22 @@ implementation
            hp:=tasmsymbol.create(s,_bind,_typ);
            hp:=tasmsymbol.create(s,_bind,_typ);
            FAsmSymbolDict.insert(hp);
            FAsmSymbolDict.insert(hp);
          end;
          end;
-        newasmsymbol:=hp;
+        result:=hp;
+      end;
+
+
+    function TAsmData.RefAsmSymbol(const s : string) : tasmsymbol;
+      var
+        hp : tasmsymbol;
+      begin
+        hp:=tasmsymbol(FAsmSymbolDict.search(s));
+        if not assigned(hp) then
+         begin
+           { Not found, insert it. }
+           hp:=tasmsymbol.create(s,AB_EXTERNAL,AT_NONE);
+           FAsmSymbolDict.insert(hp);
+         end;
+        result:=hp;
       end;
       end;
 
 
 
 
@@ -372,19 +385,6 @@ implementation
       end;
       end;
 
 
 
 
-    function  TAsmData.newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel;
-      var
-        hp : tasmlabel;
-      begin
-        if is_global then
-         hp:=tasmlabel.createglobal(name,nr,alt)
-       else
-         hp:=tasmlabel.createlocal(nr,alt);
-        FAsmSymbolDict.insert(hp);
-        result:=hp;
-      end;
-
-
     procedure TAsmData.getlabel(var l : tasmlabel;alt:tasmlabeltype);
     procedure TAsmData.getlabel(var l : tasmlabel;alt:tasmlabeltype);
       begin
       begin
         l:=tasmlabel.createlocal(FNextLabelNr[alt],alt);
         l:=tasmlabel.createlocal(FNextLabelNr[alt],alt);

+ 9 - 9
compiler/aasmtai.pas

@@ -398,7 +398,7 @@ interface
           constructor Create_rel_sym(_typ:taiconst_type;_sym,_endsym:tasmsymbol);
           constructor Create_rel_sym(_typ:taiconst_type;_sym,_endsym:tasmsymbol);
           constructor Create_rva_sym(_sym:tasmsymbol);
           constructor Create_rva_sym(_sym:tasmsymbol);
           constructor Create_indirect_sym(_sym:tasmsymbol);
           constructor Create_indirect_sym(_sym:tasmsymbol);
-          constructor Createname(const name:string;_symtyp:Tasmsymtype;ofs:aint);
+          constructor Createname(const name:string;ofs:aint);
           constructor Createname_rva(const name:string);
           constructor Createname_rva(const name:string);
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
@@ -856,7 +856,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,AT_DATA);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -869,7 +869,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -931,7 +931,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,_symtyp);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_symtyp);
          size:=siz;
          size:=siz;
          is_global:=false;
          is_global:=false;
       end;
       end;
@@ -941,7 +941,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,_symtyp);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_symtyp);
          size:=siz;
          size:=siz;
          is_global:=true;
          is_global:=true;
       end;
       end;
@@ -986,7 +986,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol_end;
          typ:=ait_symbol_end;
-         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_NONE);
+         sym:=current_asmdata.RefAsmSymbol(_name);
       end;
       end;
 
 
 
 
@@ -1231,12 +1231,12 @@ implementation
       end;
       end;
 
 
 
 
-    constructor tai_const.Createname(const name:string;_symtyp:Tasmsymtype;ofs:aint);
+    constructor tai_const.Createname(const name:string;ofs:aint);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const;
          typ:=ait_const;
          consttype:=aitconst_ptr;
          consttype:=aitconst_ptr;
-         sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,_symtyp);
+         sym:=current_asmdata.RefAsmSymbol(name);
          endsym:=nil;
          endsym:=nil;
          value:=ofs;
          value:=ofs;
          { update sym info }
          { update sym info }
@@ -1249,7 +1249,7 @@ implementation
          inherited Create;
          inherited Create;
          typ:=ait_const;
          typ:=ait_const;
          consttype:=aitconst_rva_symbol;
          consttype:=aitconst_rva_symbol;
-         sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION);
+         sym:=current_asmdata.RefAsmSymbol(name);
          endsym:=nil;
          endsym:=nil;
          value:=0;
          value:=0;
          { update sym info }
          { update sym info }

+ 3 - 3
compiler/arm/cgcpu.pas

@@ -270,7 +270,7 @@ unit cgcpu;
 
 
     procedure tcgarm.a_call_name(list : TAsmList;const s : string);
     procedure tcgarm.a_call_name(list : TAsmList;const s : string);
       begin
       begin
-        list.concat(taicpu.op_sym(A_BL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)));
 {
 {
         the compiler does not properly set this flag anymore in pass 1, and
         the compiler does not properly set this flag anymore in pass 1, and
         for now we only need it after pass 2 (I hope) (JM)
         for now we only need it after pass 2 (I hope) (JM)
@@ -936,7 +936,7 @@ unit cgcpu;
 
 
     procedure tcgarm.a_jmp_name(list : TAsmList;const s : string);
     procedure tcgarm.a_jmp_name(list : TAsmList;const s : string);
       begin
       begin
-        list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s)));
       end;
       end;
 
 
 
 
@@ -1478,7 +1478,7 @@ unit cgcpu;
           end
           end
         { case 0 }
         { case 0 }
         else
         else
-          list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+          list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
 
 
         list.concat(Tai_symbol_end.Createname(labelname));
         list.concat(Tai_symbol_end.Createname(labelname));
       end;
       end;

+ 3 - 3
compiler/cgobj.pas

@@ -1873,7 +1873,7 @@ implementation
         paramanager.getintparaloc(pocall_default,2,cgpara2);
         paramanager.getintparaloc(pocall_default,2,cgpara2);
         if (cs_check_object in aktlocalswitches) then
         if (cs_check_object in aktlocalswitches) then
          begin
          begin
-           reference_reset_symbol(hrefvmt,current_asmdata.newasmsymbol(objdef.vmt_mangledname,AB_EXTERNAL,AT_DATA),0);
+           reference_reset_symbol(hrefvmt,current_asmdata.RefAsmSymbol(objdef.vmt_mangledname),0);
            paramanager.allocparaloc(list,cgpara2);
            paramanager.allocparaloc(list,cgpara2);
            a_paramaddr_ref(list,hrefvmt,cgpara2);
            a_paramaddr_ref(list,hrefvmt,cgpara2);
            paramanager.allocparaloc(list,cgpara1);
            paramanager.allocparaloc(list,cgpara1);
@@ -2115,9 +2115,9 @@ implementation
               l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr');
               l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr');
               if not(assigned(l)) then
               if not(assigned(l)) then
                 begin
                 begin
-                  l:=current_asmdata.newasmsymbol('L'+symname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
+                  l:=current_asmdata.DefineAsmSymbol('L'+symname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
                   current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(l,0));
                   current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(l,0));
-                  current_asmdata.asmlists[al_picdata].concat(tai_const.create_indirect_sym(current_asmdata.newasmsymbol(symname,AB_EXTERNAL,AT_DATA)));
+                  current_asmdata.asmlists[al_picdata].concat(tai_const.create_indirect_sym(current_asmdata.RefAsmSymbol(symname)));
                   current_asmdata.asmlists[al_picdata].concat(tai_const.create_32bit(0));
                   current_asmdata.asmlists[al_picdata].concat(tai_const.create_32bit(0));
                 end;
                 end;
               result := cg.getaddressregister(list);
               result := cg.getaddressregister(list);

+ 1 - 1
compiler/cresstr.pas

@@ -189,7 +189,7 @@ uses
             }
             }
             current_asmdata.asmlists[al_resourcestrings].concat(Tai_cutobject.Create);
             current_asmdata.asmlists[al_resourcestrings].concat(Tai_cutobject.Create);
             new_section(current_asmdata.asmlists[al_resourcestrings],sec_data,'resstridx_'+r.name,sizeof(aint));
             new_section(current_asmdata.asmlists[al_resourcestrings],sec_data,'resstridx_'+r.name,sizeof(aint));
-            resstrlab:=current_asmdata.newasmsymbol(make_mangledname('RESSTR',R.Sym.owner,R.Sym.name),AB_GLOBAL,AT_DATA);
+            resstrlab:=current_asmdata.DefineAsmSymbol(make_mangledname('RESSTR',R.Sym.owner,R.Sym.name),AB_GLOBAL,AT_DATA);
             current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol.Create_global(resstrlab,0));
             current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol.Create_global(resstrlab,0));
             current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(namelab));
             current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(namelab));
             current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));
             current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));

+ 9 - 9
compiler/dbgdwarf.pas

@@ -1450,7 +1450,7 @@ implementation
             current_asmdata.getlabel(procendlabel,alt_dbgtype);
             current_asmdata.getlabel(procendlabel,alt_dbgtype);
             current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),pd.procendtai);
             current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),pd.procendtai);
 
 
-            append_labelentry(DW_AT_low_pc,current_asmdata.newasmsymbol(pd.mangledname,AB_LOCAL,AT_DATA));
+            append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(pd.mangledname));
             append_labelentry(DW_AT_high_pc,procendlabel);
             append_labelentry(DW_AT_high_pc,procendlabel);
 
 
             {
             {
@@ -1551,7 +1551,7 @@ implementation
                         else
                         else
                           begin
                           begin
                             templist.concat(tai_const.create_8bit(3));
                             templist.concat(tai_const.create_8bit(3));
-                            templist.concat(tai_const.createname(sym.mangledname,AT_DATA,0));
+                            templist.concat(tai_const.createname(sym.mangledname,0));
                             blocksize:=1+sizeof(aword);
                             blocksize:=1+sizeof(aword);
                           end;
                           end;
                       end;
                       end;
@@ -1707,7 +1707,7 @@ implementation
               toasm :
               toasm :
                 begin
                 begin
                   templist.concat(tai_const.create_8bit(3));
                   templist.concat(tai_const.create_8bit(3));
-                  templist.concat(tai_const.createname(sym.mangledname,AT_DATA,0));
+                  templist.concat(tai_const.createname(sym.mangledname,0));
                   blocksize:=1+sizeof(aword);
                   blocksize:=1+sizeof(aword);
                 end;
                 end;
               tovar:
               tovar:
@@ -1774,7 +1774,7 @@ implementation
               ]);
               ]);
               { append block data }
               { append block data }
               current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(3));
               current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(3));
-              current_asmdata.asmlists[al_dwarf_info].concat(tai_const.createname(sym.mangledname,AT_DATA,0));
+              current_asmdata.asmlists[al_dwarf_info].concat(tai_const.createname(sym.mangledname,0));
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(ttypedconstsym(sym).typedconsttype.def));
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(ttypedconstsym(sym).typedconsttype.def));
 
 
               finish_entry;
               finish_entry;
@@ -1920,10 +1920,10 @@ implementation
         { abbrev table }
         { abbrev table }
         if isdwarf64 then
         if isdwarf64 then
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_64bit,
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_64bit,
-            current_asmdata.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA)))
+            current_asmdata.RefAsmSymbol('.Ldebug_abbrev0')))
         else
         else
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_32bit,
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_32bit,
-            current_asmdata.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA)));
+            current_asmdata.RefAsmSymbol('.Ldebug_abbrev0')));
         { address size }
         { address size }
         current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sizeof(aint)));
         current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sizeof(aint)));
 
 
@@ -1935,9 +1935,9 @@ implementation
           DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);
           DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);
 
 
         { reference to line info section }
         { reference to line info section }
-        append_labelentry_data(DW_AT_stmt_list,current_asmdata.newasmsymbol('.Ldebug_line0',AB_LOCAL,AT_DATA));
-        append_labelentry(DW_AT_low_pc,current_asmdata.newasmsymbol('.Ltext0',AB_LOCAL,AT_DATA));
-        append_labelentry(DW_AT_high_pc,current_asmdata.newasmsymbol('.Letext0',AB_LOCAL,AT_DATA));
+        append_labelentry_data(DW_AT_stmt_list,current_asmdata.RefAsmSymbol('.Ldebug_line0'));
+        append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol('.Ltext0'));
+        append_labelentry(DW_AT_high_pc,current_asmdata.RefAsmSymbol('.Letext0'));
 
 
         finish_entry;
         finish_entry;
 
 

+ 2 - 2
compiler/dbgstabs.pas

@@ -1495,11 +1495,11 @@ implementation
             while assigned(hp) do
             while assigned(hp) do
               begin
               begin
                 If (hp.u.flags and uf_has_debuginfo)=uf_has_debuginfo then
                 If (hp.u.flags and uf_has_debuginfo)=uf_has_debuginfo then
-                  list.concat(Tai_const.Createname(make_mangledname('DEBUGINFO',hp.u.globalsymtable,''),AT_DATA,0));
+                  list.concat(Tai_const.Createname(make_mangledname('DEBUGINFO',hp.u.globalsymtable,''),0));
                 hp:=tused_unit(hp.next);
                 hp:=tused_unit(hp.next);
               end;
               end;
             { include reference to debuginfo for this program }
             { include reference to debuginfo for this program }
-            list.concat(Tai_const.Createname(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_DATA,0));
+            list.concat(Tai_const.Createname(make_mangledname('DEBUGINFO',current_module.localsymtable,''),0));
           end;
           end;
       end;
       end;
 
 

+ 1 - 1
compiler/i386/cgcpu.pas

@@ -641,7 +641,7 @@ unit cgcpu;
         { case 0 }
         { case 0 }
         else
         else
           begin
           begin
-            lab:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+            lab:=current_asmdata.RefAsmSymbol(procdef.mangledname);
             list.concat(taicpu.op_sym(A_JMP,S_NO,lab));
             list.concat(taicpu.op_sym(A_JMP,S_NO,lab));
           end;
           end;
 
 

+ 2 - 2
compiler/i386/ra386int.pas

@@ -1395,7 +1395,7 @@ Unit Ra386int;
                    if GotStar then
                    if GotStar then
                     Message(asmr_e_only_add_relocatable_symbol);
                     Message(asmr_e_only_add_relocatable_symbol);
                    if not assigned(oper.opr.ref.symbol) then
                    if not assigned(oper.opr.ref.symbol) then
-                    oper.opr.ref.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp)
+                    oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
                    else
                    else
                     Message(asmr_e_cant_have_multiple_relocatable_symbols);
                     Message(asmr_e_cant_have_multiple_relocatable_symbols);
                  end;
                  end;
@@ -1478,7 +1478,7 @@ Unit Ra386int;
           begin
           begin
             oper.opr.typ:=OPR_SYMBOL;
             oper.opr.typ:=OPR_SYMBOL;
             oper.opr.symofs:=l;
             oper.opr.symofs:=l;
-            oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp);
+            oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr);
           end
           end
         else
         else
           if oper.opr.typ=OPR_NONE then
           if oper.opr.typ=OPR_NONE then

+ 2 - 2
compiler/m68k/cgcpu.pas

@@ -247,7 +247,7 @@ unit cgcpu;
     procedure tcg68k.a_call_name(list : TAsmList;const s : string);
     procedure tcg68k.a_call_name(list : TAsmList;const s : string);
 
 
       begin
       begin
-        list.concat(taicpu.op_sym(A_JSR,S_NO,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        list.concat(taicpu.op_sym(A_JSR,S_NO,current_asmdata.RefAsmSymbol(s)));
       end;
       end;
 
 
 
 
@@ -1261,7 +1261,7 @@ unit cgcpu;
           end
           end
         { case 0 }
         { case 0 }
         else
         else
-//          list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+//          list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
 
 
         List.concat(Tai_symbol_end.Createname(labelname));
         List.concat(Tai_symbol_end.Createname(labelname));
       end;
       end;

+ 1 - 1
compiler/m68k/ra68kmot.pas

@@ -1311,7 +1311,7 @@ const
                           l:=oper.opr.val;
                           l:=oper.opr.val;
                           oper.opr.typ := OPR_SYMBOL;
                           oper.opr.typ := OPR_SYMBOL;
                           oper.opr.symofs := l;
                           oper.opr.symofs := l;
-                          oper.opr.symbol := current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION);
+                          oper.opr.symbol := current_asmdata.RefAsmSymbol(tempstr);
                         end;
                         end;
                  end;
                  end;
    { // Constant memory offset .              // }
    { // Constant memory offset .              // }

+ 3 - 3
compiler/ncgcnv.pas

@@ -155,7 +155,7 @@ interface
                if tstringconstnode(left).len=0 then
                if tstringconstnode(left).len=0 then
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
-                  hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA);
+                  hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
                   location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
                   location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
                   cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
                   cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
                 end
                 end
@@ -175,7 +175,7 @@ interface
                if tstringconstnode(left).len=0 then
                if tstringconstnode(left).len=0 then
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
-                  hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA);
+                  hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
                   location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
                   location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
                   cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
                   cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
                 end
                 end
@@ -430,7 +430,7 @@ interface
          end;
          end;
          cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,location.register,l1);
          cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,location.register,l1);
          reference_reset(hr);
          reference_reset(hr);
-         hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA);
+         hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
          cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
          cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
          cg.a_label(current_asmdata.CurrAsmList,l1);
          cg.a_label(current_asmdata.CurrAsmList,l1);
       end;
       end;

+ 1 - 1
compiler/ncgflw.pas

@@ -1242,7 +1242,7 @@ implementation
          current_asmdata.getjumplabel(nextonlabel);
          current_asmdata.getjumplabel(nextonlabel);
 
 
          { send the vmt parameter }
          { send the vmt parameter }
-         reference_reset_symbol(href2,current_asmdata.newasmsymbol(excepttype.vmt_mangledname,AB_EXTERNAL,AT_DATA),0);
+         reference_reset_symbol(href2,current_asmdata.RefAsmSymbol(excepttype.vmt_mangledname),0);
          paramanager.getintparaloc(pocall_default,1,paraloc1);
          paramanager.getintparaloc(pocall_default,1,paraloc1);
          paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1);
          paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1);
          cg.a_paramaddr_ref(current_asmdata.CurrAsmList,href2,paraloc1);
          cg.a_paramaddr_ref(current_asmdata.CurrAsmList,href2,paraloc1);

+ 1 - 1
compiler/ncginl.pas

@@ -266,7 +266,7 @@ implementation
         if left.nodetype=typen then
         if left.nodetype=typen then
           begin
           begin
             hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
             hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
-            reference_reset_symbol(href,current_asmdata.newasmsymbol(tobjectdef(left.resulttype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0);
+            reference_reset_symbol(href,current_asmdata.RefAsmSymbol(tobjectdef(left.resulttype.def).vmt_mangledname),0);
             cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
             cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
           end
           end
         else
         else

+ 11 - 11
compiler/ncgld.pas

@@ -72,7 +72,7 @@ implementation
       begin
       begin
 {$ifndef sparc}
 {$ifndef sparc}
         location.reference.base:=current_procinfo.got;
         location.reference.base:=current_procinfo.got;
-        location.reference.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA);
+        location.reference.symbol:=current_asmdata.RefAsmSymbol(tglobalvarsym(symtableentry).mangledname+'@GOT');
 {$endif sparc}
 {$endif sparc}
       end;
       end;
 
 
@@ -105,7 +105,7 @@ implementation
                         location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                         location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                       end;
                       end;
                     toasm :
                     toasm :
-                      location.reference.symbol:=current_asmdata.newasmsymbol(tabsolutevarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
+                      location.reference.symbol:=current_asmdata.RefAsmSymbol(tabsolutevarsym(symtableentry).mangledname);
                     else
                     else
                       internalerror(200310283);
                       internalerror(200310283);
                   end;
                   end;
@@ -115,7 +115,7 @@ implementation
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                    begin
                    begin
                       location_reset(location,LOC_CREFERENCE,OS_ADDR);
                       location_reset(location,LOC_CREFERENCE,OS_ADDR);
-                      location.reference.symbol:=current_asmdata.newasmsymbol(make_mangledname('RESSTR',symtableentry.owner,symtableentry.name),AB_EXTERNAL,AT_DATA);
+                      location.reference.symbol:=current_asmdata.RefAsmSymbol(make_mangledname('RESSTR',symtableentry.owner,symtableentry.name));
                       { Resourcestring layout:
                       { Resourcestring layout:
                           TResourceStringRecord = Packed Record
                           TResourceStringRecord = Packed Record
                              Name,
                              Name,
@@ -147,7 +147,7 @@ implementation
                   { DLL variable }
                   { DLL variable }
                     begin
                     begin
                       hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                       hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
-                      location.reference.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
+                      location.reference.symbol:=current_asmdata.RefAsmSymbol(tglobalvarsym(symtableentry).mangledname);
                       cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,location.reference,hregister);
                       cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,location.reference,hregister);
                       reference_reset_base(location.reference,hregister,0);
                       reference_reset_base(location.reference,hregister,0);
                     end
                     end
@@ -171,11 +171,11 @@ implementation
                        paraloc1.init;
                        paraloc1.init;
                        paramanager.getintparaloc(pocall_default,1,paraloc1);
                        paramanager.getintparaloc(pocall_default,1,paraloc1);
                        hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                        hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
-                       reference_reset_symbol(href,current_asmdata.newasmsymbol('FPC_THREADVAR_RELOCATE',AB_EXTERNAL,AT_DATA),0);
+                       reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE'),0);
                        cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,hregister);
                        cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,hregister);
                        cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,hregister,norelocatelab);
                        cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,hregister,norelocatelab);
                        { don't save the allocated register else the result will be destroyed later }
                        { don't save the allocated register else the result will be destroyed later }
-                       reference_reset_symbol(href,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0);
+                       reference_reset_symbol(href,current_asmdata.RefAsmSymbol(tglobalvarsym(symtableentry).mangledname),0);
                        paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1);
                        paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1);
                        cg.a_param_ref(current_asmdata.CurrAsmList,OS_32,href,paraloc1);
                        cg.a_param_ref(current_asmdata.CurrAsmList,OS_32,href,paraloc1);
                        paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1);
                        paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1);
@@ -193,7 +193,7 @@ implementation
                          layout of a threadvar is (4 bytes pointer):
                          layout of a threadvar is (4 bytes pointer):
                            0 - Threadvar index
                            0 - Threadvar index
                            4 - Threadvar value in single threading }
                            4 - Threadvar value in single threading }
-                       reference_reset_symbol(href,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),sizeof(aint));
+                       reference_reset_symbol(href,current_asmdata.RefAsmSymbol(tglobalvarsym(symtableentry).mangledname),sizeof(aint));
                        cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
                        cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
                        cg.a_label(current_asmdata.CurrAsmList,endrelocatelab);
                        cg.a_label(current_asmdata.CurrAsmList,endrelocatelab);
                        location.reference.base:=hregister;
                        location.reference.base:=hregister;
@@ -246,7 +246,7 @@ implementation
                               staticsymtable :
                               staticsymtable :
                                 begin
                                 begin
                                   if tabstractnormalvarsym(symtableentry).localloc.loc=LOC_INVALID then
                                   if tabstractnormalvarsym(symtableentry).localloc.loc=LOC_INVALID then
-                                    reference_reset_symbol(location.reference,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0)
+                                    reference_reset_symbol(location.reference,current_asmdata.RefAsmSymbol(tglobalvarsym(symtableentry).mangledname),0)
                                   else
                                   else
                                     location:=tglobalvarsym(symtableentry).localloc;
                                     location:=tglobalvarsym(symtableentry).localloc;
 {$ifdef i386}
 {$ifdef i386}
@@ -360,7 +360,7 @@ implementation
                       else
                       else
                         begin
                         begin
                           { load address of the function }
                           { load address of the function }
-                          reference_reset_symbol(href,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION),0);
+                          reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0);
                           hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                           hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                           cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
                           cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
                           cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
                           cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
@@ -372,11 +372,11 @@ implementation
                          location.reference.base := cg.g_indirect_sym_load(current_asmdata.CurrAsmList,tprocsym(symtableentry).procdef[1].mangledname);
                          location.reference.base := cg.g_indirect_sym_load(current_asmdata.CurrAsmList,tprocsym(symtableentry).procdef[1].mangledname);
                        {!!!!! Be aware, work on virtual methods too }
                        {!!!!! Be aware, work on virtual methods too }
                        if (location.reference.base = NR_NO) then
                        if (location.reference.base = NR_NO) then
-                         location.reference.symbol:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+                         location.reference.symbol:=current_asmdata.RefAsmSymbol(procdef.mangledname);
                     end;
                     end;
                end;
                end;
             typedconstsym :
             typedconstsym :
-              location.reference.symbol:=current_asmdata.newasmsymbol(ttypedconstsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
+              location.reference.symbol:=current_asmdata.RefAsmSymbol(ttypedconstsym(symtableentry).mangledname);
             labelsym :
             labelsym :
               location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel;
               location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel;
             else internalerror(200510032);
             else internalerror(200510032);

+ 3 - 3
compiler/ncgmem.pas

@@ -101,7 +101,7 @@ implementation
          if (left.nodetype=typen) then
          if (left.nodetype=typen) then
            begin
            begin
              reference_reset_symbol(href,
              reference_reset_symbol(href,
-               current_asmdata.newasmsymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0);
+               current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname),0);
              location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
              location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
              cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
              cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
            end
            end
@@ -312,7 +312,7 @@ implementation
                LOC_REFERENCE,
                LOC_REFERENCE,
                LOC_CREFERENCE:
                LOC_CREFERENCE:
                  ;
                  ;
-{              record regvars are not supported yet 
+{              record regvars are not supported yet
                LOC_CREGISTER:                        }
                LOC_CREGISTER:                        }
                else
                else
                  internalerror(2006031901);
                  internalerror(2006031901);
@@ -697,7 +697,7 @@ implementation
                  current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
                  current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
                end;
                end;
               secondpass(right);
               secondpass(right);
-              
+
               { if mulsize = 1, we won't have to modify the index }
               { if mulsize = 1, we won't have to modify the index }
               location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,(mulsize = 1));
               location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,(mulsize = 1));
 
 

+ 4 - 8
compiler/ncgutil.pas

@@ -1737,11 +1737,7 @@ implementation
         item := tstringlistitem(pd.aliasnames.first);
         item := tstringlistitem(pd.aliasnames.first);
         while assigned(item) do
         while assigned(item) do
           begin
           begin
-            if (cs_profile in aktmoduleswitches) or
-               (po_global in current_procinfo.procdef.procoptions) then
-               current_asmdata.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION)
-            else
-               current_asmdata.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION);
+            current_asmdata.DefineAsmSymbol(item.str,AB_GLOBAL,AT_FUNCTION);
             item := tstringlistitem(item.next);
             item := tstringlistitem(item.next);
           end;
           end;
        end;
        end;
@@ -1786,7 +1782,7 @@ implementation
             else
             else
               list.concat(tai_directive.create(asd_mod_term_func,''));
               list.concat(tai_directive.create(asd_mod_term_func,''));
             list.concat(tai_align.create(4));
             list.concat(tai_align.create(4));
-            list.concat(Tai_const.Createname(current_procinfo.procdef.mangledname,AT_FUNCTION,0));
+            list.concat(Tai_const.Createname(current_procinfo.procdef.mangledname,0));
           end;
           end;
 
 
         if (current_procinfo.procdef.proctypeoption=potype_proginit) then
         if (current_procinfo.procdef.proctypeoption=potype_proginit) then
@@ -1940,7 +1936,7 @@ implementation
           begin
           begin
             current_module.requires_ebx_pic_helper:=true;
             current_module.requires_ebx_pic_helper:=true;
             cg.a_call_name_static(list,'fpc_geteipasebx');
             cg.a_call_name_static(list,'fpc_geteipasebx');
-            list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,current_asmdata.newasmsymbol('_GLOBAL_OFFSET_TABLE_',AB_EXTERNAL,AT_DATA),0,NR_PIC_OFFSET_REG));
+            list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),0,NR_PIC_OFFSET_REG));
             list.concat(tai_regalloc.alloc(NR_PIC_OFFSET_REG,nil));
             list.concat(tai_regalloc.alloc(NR_PIC_OFFSET_REG,nil));
             { ecx could be used in leave procedures }
             { ecx could be used in leave procedures }
             current_procinfo.got:=NR_EBX;
             current_procinfo.got:=NR_EBX;
@@ -2110,7 +2106,7 @@ implementation
                                   { PIC, DLL and Threadvar need extra code and are handled in ncgld }
                                   { PIC, DLL and Threadvar need extra code and are handled in ncgld }
                                   if not(vo_is_dll_var in varoptions) and ((tf_section_threadvars in target_info.flags) or
                                   if not(vo_is_dll_var in varoptions) and ((tf_section_threadvars in target_info.flags) or
                                      not(vo_is_thread_var in varoptions)) then
                                      not(vo_is_thread_var in varoptions)) then
-                                    reference_reset_symbol(localloc.reference,current_asmdata.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA),0);
+                                    reference_reset_symbol(localloc.reference,current_asmdata.RefAsmSymbol(mangledname),0);
                                 end;
                                 end;
                               else
                               else
                                 internalerror(200410103);
                                 internalerror(200410103);

+ 9 - 9
compiler/nobj.pas

@@ -280,7 +280,7 @@ implementation
 
 
          { write name label }
          { write name label }
          current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(p^.nl));
          current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(p^.nl));
-         current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0));
+         current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,0));
 
 
          if assigned(p^.r) then
          if assigned(p^.r) then
            writestrentry(p^.r);
            writestrentry(p^.r);
@@ -322,7 +322,7 @@ implementation
 
 
          { write name label }
          { write name label }
          current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i));
          current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i));
-         current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0));
+         current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,0));
 
 
          if assigned(p^.r) then
          if assigned(p^.r) then
            writeintentry(p^.r);
            writeintentry(p^.r);
@@ -398,7 +398,7 @@ implementation
       begin
       begin
          if assigned(p^.l) then
          if assigned(p^.l) then
            writedmtaddressentry(p^.l);
            writedmtaddressentry(p^.l);
-         al_globals.concat(Tai_const_symbol.Createname(p^.data.mangledname,AT_FUNCTION,0));
+         al_globals.concat(Tai_const_symbol.Createname(p^.data.mangledname,0));
          if assigned(p^.r) then
          if assigned(p^.r) then
            writedmtaddressentry(p^.r);
            writedmtaddressentry(p^.r);
       end;
       end;
@@ -484,7 +484,7 @@ implementation
                      if po_abstractmethod in pd.procoptions then
                      if po_abstractmethod in pd.procoptions then
                        current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil))
                        current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil))
                      else
                      else
-                       current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0));
+                       current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(pd.mangledname,0));
                    end;
                    end;
                 end;
                 end;
            end;
            end;
@@ -884,7 +884,7 @@ implementation
               tostr(i)+'_$_'+
               tostr(i)+'_$_'+
               implintf.implprocs(intfindex,i).mangledname);
               implintf.implprocs(intfindex,i).mangledname);
             { create reference }
             { create reference }
-            rawdata.concat(Tai_const.Createname(tmps,AT_FUNCTION,0));
+            rawdata.concat(Tai_const.Createname(tmps,0));
           end;
           end;
         section_symbol_end(rawdata,gintfgetvtbllabelname(intfindex));
         section_symbol_end(rawdata,gintfgetvtbllabelname(intfindex));
       end;
       end;
@@ -919,7 +919,7 @@ implementation
             current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
             current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
           end;
           end;
         { VTable }
         { VTable }
-        current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(gintfgetvtbllabelname(contintfindex),AT_DATA,0));
+        current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(gintfgetvtbllabelname(contintfindex),0));
         { IOffset field }
         { IOffset field }
         current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(implintf.ioffsets(contintfindex)));
         current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(implintf.ioffsets(contintfindex)));
         { IIDStr }
         { IIDStr }
@@ -1232,9 +1232,9 @@ implementation
                                   { class abstract and it's not allow to      }
                                   { class abstract and it's not allow to      }
                                   { generates an instance                     }
                                   { generates an instance                     }
                                   if (po_abstractmethod in procdefcoll^.data.procoptions) then
                                   if (po_abstractmethod in procdefcoll^.data.procoptions) then
-                                    List.concat(Tai_const.Createname('FPC_ABSTRACTERROR',AT_FUNCTION,0))
+                                    List.concat(Tai_const.Createname('FPC_ABSTRACTERROR',0))
                                   else
                                   else
-                                    List.concat(Tai_const.createname(procdefcoll^.data.mangledname,AT_FUNCTION,0));
+                                    List.concat(Tai_const.createname(procdefcoll^.data.mangledname,0));
                                end;
                                end;
                           end;
                           end;
                         procdefcoll:=procdefcoll^.next;
                         procdefcoll:=procdefcoll^.next;
@@ -1310,7 +1310,7 @@ implementation
          { it is not written for parents that don't have any vmt !! }
          { it is not written for parents that don't have any vmt !! }
          if assigned(_class.childof) and
          if assigned(_class.childof) and
             (oo_has_vmt in _class.childof.objectoptions) then
             (oo_has_vmt in _class.childof.objectoptions) then
-           current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,AT_DATA,0))
+           current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,0))
          else
          else
            current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
            current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
 
 

+ 10 - 10
compiler/pmodules.pas

@@ -164,7 +164,7 @@ implementation
          begin
          begin
            If (hp.u.flags and uf_threadvars)=uf_threadvars then
            If (hp.u.flags and uf_threadvars)=uf_threadvars then
             begin
             begin
-              ltvTables.concat(Tai_const.Createname(make_mangledname('THREADVARLIST',hp.u.globalsymtable,''),AT_DATA,0));
+              ltvTables.concat(Tai_const.Createname(make_mangledname('THREADVARLIST',hp.u.globalsymtable,''),0));
               inc(count);
               inc(count);
             end;
             end;
            hp:=tused_unit(hp.next);
            hp:=tused_unit(hp.next);
@@ -172,7 +172,7 @@ implementation
         { Add program threadvars, if any }
         { Add program threadvars, if any }
         If (current_module.flags and uf_threadvars)=uf_threadvars then
         If (current_module.flags and uf_threadvars)=uf_threadvars then
          begin
          begin
-           ltvTables.concat(Tai_const.Createname(make_mangledname('THREADVARLIST',current_module.localsymtable,''),AT_DATA,0));
+           ltvTables.concat(Tai_const.Createname(make_mangledname('THREADVARLIST',current_module.localsymtable,''),0));
            inc(count);
            inc(count);
          end;
          end;
         { Insert TableCount at start }
         { Insert TableCount at start }
@@ -195,7 +195,7 @@ implementation
            (vo_is_thread_var in tglobalvarsym(p).varoptions) then
            (vo_is_thread_var in tglobalvarsym(p).varoptions) then
          begin
          begin
            { address of threadvar }
            { address of threadvar }
-           ltvTable.concat(tai_const.Createname(tglobalvarsym(p).mangledname,AT_DATA,0));
+           ltvTable.concat(tai_const.Createname(tglobalvarsym(p).mangledname,0));
            { size of threadvar }
            { size of threadvar }
            ltvTable.concat(tai_const.create_32bit(tglobalvarsym(p).getsize));
            ltvTable.concat(tai_const.create_32bit(tglobalvarsym(p).getsize));
          end;
          end;
@@ -255,7 +255,7 @@ implementation
           begin
           begin
           { Valid pointer to resource information }
           { Valid pointer to resource information }
           ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0));
           ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0));
-          ResourceInfo.concat(Tai_const.Createname('FPC_RESSYMBOL',AT_DATA,0));
+          ResourceInfo.concat(Tai_const.Createname('FPC_RESSYMBOL',0));
 {$ifdef EXTERNALRESPTRS}
 {$ifdef EXTERNALRESPTRS}
           current_module.linkotherofiles.add('resptrs.o',link_always);
           current_module.linkotherofiles.add('resptrs.o',link_always);
 {$else EXTERNALRESPTRS}
 {$else EXTERNALRESPTRS}
@@ -291,8 +291,8 @@ implementation
           begin
           begin
             If (hp.flags and uf_has_resourcestrings)=uf_has_resourcestrings then
             If (hp.flags and uf_has_resourcestrings)=uf_has_resourcestrings then
               begin
               begin
-                ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'START'),AT_DATA,0));
-                ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'END'),AT_DATA,0));
+                ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'START'),0));
+                ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'END'),0));
                 inc(count);
                 inc(count);
               end;
               end;
             hp:=tmodule(hp.next);
             hp:=tmodule(hp.next);
@@ -324,11 +324,11 @@ implementation
            if (hp.u.flags and (uf_init or uf_finalize))<>0 then
            if (hp.u.flags and (uf_init or uf_finalize))<>0 then
             begin
             begin
               if (hp.u.flags and uf_init)<>0 then
               if (hp.u.flags and uf_init)<>0 then
-               unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',hp.u.globalsymtable,''),AT_FUNCTION,0))
+               unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',hp.u.globalsymtable,''),0))
               else
               else
                unitinits.concat(Tai_const.Create_sym(nil));
                unitinits.concat(Tai_const.Create_sym(nil));
               if (hp.u.flags and uf_finalize)<>0 then
               if (hp.u.flags and uf_finalize)<>0 then
-               unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,''),AT_FUNCTION,0))
+               unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,''),0))
               else
               else
                unitinits.concat(Tai_const.Create_sym(nil));
                unitinits.concat(Tai_const.Create_sym(nil));
               inc(count);
               inc(count);
@@ -339,11 +339,11 @@ implementation
         if (current_module.flags and (uf_init or uf_finalize))<>0 then
         if (current_module.flags and (uf_init or uf_finalize))<>0 then
          begin
          begin
            if (current_module.flags and uf_init)<>0 then
            if (current_module.flags and uf_init)<>0 then
-            unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',current_module.localsymtable,''),AT_FUNCTION,0))
+            unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',current_module.localsymtable,''),0))
            else
            else
             unitinits.concat(Tai_const.Create_sym(nil));
             unitinits.concat(Tai_const.Create_sym(nil));
            if (current_module.flags and uf_finalize)<>0 then
            if (current_module.flags and uf_finalize)<>0 then
-            unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,''),AT_FUNCTION,0))
+            unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,''),0))
            else
            else
             unitinits.concat(Tai_const.Create_sym(nil));
             unitinits.concat(Tai_const.Create_sym(nil));
            inc(count);
            inc(count);

+ 12 - 14
compiler/powerpc/cgcpu.pas

@@ -371,10 +371,10 @@ const
 
 
         current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
         current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
         current_asmdata.asmlists[al_imports].concat(Tai_align.Create(16));
         current_asmdata.asmlists[al_imports].concat(Tai_align.Create(16));
-        result := current_asmdata.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
+        result := current_asmdata.RefAsmSymbol(stubname);
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
-        l1 := current_asmdata.newasmsymbol('L'+s+'$lazy_ptr',AB_EXTERNAL,AT_FUNCTION);
+        l1 := current_asmdata.RefAsmSymbol('L'+s+'$lazy_ptr');
         reference_reset_symbol(href,l1,0);
         reference_reset_symbol(href,l1,0);
         href.refaddr := addr_hi;
         href.refaddr := addr_hi;
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
@@ -386,7 +386,7 @@ const
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_lazy_symbol_pointer,''));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_lazy_symbol_pointer,''));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
-        current_asmdata.asmlists[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
+        current_asmdata.asmlists[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),0));
       end;
       end;
 
 
 
 
@@ -398,7 +398,7 @@ const
            with some restore code.}
            with some restore code.}
          if (target_info.system <> system_powerpc_darwin) then
          if (target_info.system <> system_powerpc_darwin) then
            begin
            begin
-             list.concat(taicpu.op_sym(A_BL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+             list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)));
              if target_info.system=system_powerpc_macos then
              if target_info.system=system_powerpc_macos then
                list.concat(taicpu.op_none(A_NOP));
                list.concat(taicpu.op_none(A_NOP));
            end
            end
@@ -907,7 +907,7 @@ const
          if (target_info.system = system_powerpc_darwin) then
          if (target_info.system = system_powerpc_darwin) then
            p := taicpu.op_sym(A_B,get_darwin_call_stub(s))
            p := taicpu.op_sym(A_B,get_darwin_call_stub(s))
         else
         else
-          p := taicpu.op_sym(A_B,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION));
+          p := taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s));
         p.is_jmp := true;
         p.is_jmp := true;
         list.concat(p)
         list.concat(p)
       end;
       end;
@@ -1112,11 +1112,11 @@ const
 {            save floating-point registers
 {            save floating-point registers
              if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then
              if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then
                begin
                begin
-                  a_call_name(current_asmdata.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION));
+                  a_call_name(current_asmdata.RefAsmSymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g'));
                   gotgot:=true;
                   gotgot:=true;
                end
                end
              else
              else
-               a_call_name(current_asmdata.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14),AB_EXTERNAL,AT_FUNCTION));
+               a_call_name(current_asmdata.RefAsmSymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)));
 }
 }
 
 
              reference_reset_base(href,NR_R1,-8);
              reference_reset_base(href,NR_R1,-8);
@@ -1138,11 +1138,11 @@ const
              {
              {
              if cs_create_pic in aktmoduleswitches then
              if cs_create_pic in aktmoduleswitches then
                begin
                begin
-                  a_call_name(current_asmdata.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION));
+                  a_call_name(current_asmdata.RefAsmSymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g'));
                   gotgot:=true;
                   gotgot:=true;
                end
                end
              else
              else
-               a_call_name(current_asmdata.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14),AB_EXTERNAL,AT_FUNCTION))
+               a_call_name(current_asmdata.RefAsmSymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)))
              }
              }
             if (firstregint <= RS_R22) or
             if (firstregint <= RS_R22) or
                ((cs_opt_size in aktoptimizerswitches) and
                ((cs_opt_size in aktoptimizerswitches) and
@@ -1302,12 +1302,10 @@ const
              list.concat(taicpu.op_reg_reg_const(A_ADDI,r,r,(ord(R_F31)-ord(firstregfpu.enum)+1)*8));
              list.concat(taicpu.op_reg_reg_const(A_ADDI,r,r,(ord(R_F31)-ord(firstregfpu.enum)+1)*8));
              {
              {
              if (pi_do_call in current_procinfo.flags) then
              if (pi_do_call in current_procinfo.flags) then
-               a_call_name(current_asmdata.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
-                 '_x',AB_EXTERNAL,AT_FUNCTION))
+               a_call_name(current_asmdata.RefAsmSymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_x'))
              else
              else
                { leaf node => lr haven't to be restored }
                { leaf node => lr haven't to be restored }
-               a_call_name('_restfpr_'+tostr(ord(firstregfpu.enum)-ord(R_F14)+14)+
-                 '_l');
+               a_call_name('_restfpr_'+tostr(ord(firstregfpu.enum)-ord(R_F14)+14)+'_l');
              genret:=false;
              genret:=false;
              }
              }
           end;
           end;
@@ -2003,7 +2001,7 @@ const
           end
           end
         { case 0 }
         { case 0 }
         else
         else
-          list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+          list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
 
 
         List.concat(Tai_symbol_end.Createname(labelname));
         List.concat(Tai_symbol_end.Createname(labelname));
       end;
       end;

+ 1 - 1
compiler/powerpc/nppccal.pas

@@ -85,7 +85,7 @@ implementation
                   cg.getcpuregister(current_asmdata.CurrAsmList,NR_R31);
                   cg.getcpuregister(current_asmdata.CurrAsmList,NR_R31);
 
 
                   reference_reset(tmpref);
                   reference_reset(tmpref);
-                  tmpref.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(tprocdef(procdefinition).libsym).mangledname,AB_EXTERNAL,AT_DATA);
+                  tmpref.symbol:=current_asmdata.RefAsmSymbol(tglobalvarsym(tprocdef(procdefinition).libsym).mangledname);
                   tmpref.refaddr:=addr_hi;
                   tmpref.refaddr:=addr_hi;
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R31,tmpref));
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R31,tmpref));
                   tmpref.base:=NR_R31;
                   tmpref.base:=NR_R31;

+ 6 - 11
compiler/powerpc64/cgcpu.pas

@@ -563,8 +563,7 @@ procedure tcgppc.a_call_name_direct(list: TAsmList; s: string; prependDot : bool
 begin
 begin
   if (prependDot) then
   if (prependDot) then
     s := '.' + s;
     s := '.' + s;
-  list.concat(taicpu.op_sym(A_BL, current_asmdata.newasmsymbol(s, AB_EXTERNAL,
-    AT_FUNCTION)));
+  list.concat(taicpu.op_sym(A_BL, current_asmdata.RefAsmSymbol(s)));
   if (addNOP) then
   if (addNOP) then
     list.concat(taicpu.op_none(A_NOP));
     list.concat(taicpu.op_none(A_NOP));
 
 
@@ -1196,8 +1195,7 @@ procedure tcgppc.a_jmp_name(list: TAsmList; const s: string);
 var
 var
   p: taicpu;
   p: taicpu;
 begin
 begin
-  p := taicpu.op_sym(A_B, current_asmdata.newasmsymbol(s, AB_EXTERNAL,
-    AT_LABEL));
+  p := taicpu.op_sym(A_B, current_asmdata.RefAsmSymbol(s));
   p.is_jmp := true;
   p.is_jmp := true;
   list.concat(p)
   list.concat(p)
 end;
 end;
@@ -1893,9 +1891,7 @@ begin
     op_onr11methodaddr;
     op_onr11methodaddr;
   end else
   end else
     {$note ts:todo add GOT change?? - think not needed :) }
     {$note ts:todo add GOT change?? - think not needed :) }
-    list.concat(taicpu.op_sym(A_B,
-      current_asmdata.newasmsymbol('.' + procdef.mangledname, AB_EXTERNAL,
-      AT_FUNCTION)));
+    list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)));
 
 
   List.concat(Tai_symbol_end.Createname(labelname));
   List.concat(Tai_symbol_end.Createname(labelname));
 end;
 end;
@@ -1927,7 +1923,7 @@ begin
   symname := '_$' + current_asmdata.name + '$got$' + symbol;
   symname := '_$' + current_asmdata.name + '$got$' + symbol;
   l:=current_asmdata.getasmsymbol(symname);
   l:=current_asmdata.getasmsymbol(symname);
   if not(assigned(l)) then begin
   if not(assigned(l)) then begin
-    l:=current_asmdata.newasmsymbol(symname, AB_COMMON, AT_DATA);
+    l:=current_asmdata.DefineAsmSymbol(symname, AB_COMMON, AT_DATA);
     current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8));
     current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8));
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol));
@@ -2145,8 +2141,7 @@ var
   p: taicpu;
   p: taicpu;
 
 
 begin
 begin
-  p := taicpu.op_sym(op, current_asmdata.newasmsymbol(l.name, AB_EXTERNAL,
-    AT_LABEL));
+  p := taicpu.op_sym(op, current_asmdata.RefAsmSymbol(l.name));
   if op <> A_B then
   if op <> A_B then
     create_cond_norm(c, crval, p.condition);
     create_cond_norm(c, crval, p.condition);
   p.is_jmp := true;
   p.is_jmp := true;
@@ -2169,7 +2164,7 @@ begin
   symname := '_$' + current_asmdata.name + '$toc$' + hexstr(a, sizeof(a)*2);
   symname := '_$' + current_asmdata.name + '$toc$' + hexstr(a, sizeof(a)*2);
   l:=current_asmdata.getasmsymbol(symname);
   l:=current_asmdata.getasmsymbol(symname);
   if not(assigned(l)) then begin
   if not(assigned(l)) then begin
-    l:=current_asmdata.newasmsymbol(symname,AB_GLOBAL, AT_DATA);
+    l:=current_asmdata.DefineAsmSymbol(symname,AB_GLOBAL, AT_DATA);
     current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8));
     current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8));
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a)));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a)));

+ 2 - 2
compiler/psub.pas

@@ -1543,9 +1543,9 @@ implementation
            begin
            begin
              if (po_global in pd.procoptions) or
              if (po_global in pd.procoptions) or
                 (cs_profile in aktmoduleswitches) then
                 (cs_profile in aktmoduleswitches) then
-               current_asmdata.newasmsymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION)
+               current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION)
              else
              else
-               current_asmdata.newasmsymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION);
+               current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION);
            end;
            end;
 
 
          current_procinfo:=old_current_procinfo;
          current_procinfo:=old_current_procinfo;

+ 11 - 11
compiler/ptconst.pas

@@ -249,8 +249,8 @@ implementation
                      begin
                      begin
                         if not Tobjectdef(pointertype.def).is_related(Tobjectdef(pointertype.def)) then
                         if not Tobjectdef(pointertype.def).is_related(Tobjectdef(pointertype.def)) then
                           message(parser_e_illegal_expression);
                           message(parser_e_illegal_expression);
-                        datalist.concat(Tai_const.Create_sym(current_asmdata.newasmsymbol(
-                          Tobjectdef(pointertype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA)));
+                        datalist.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(
+                          Tobjectdef(pointertype.def).vmt_mangledname)));
                      end;
                      end;
                  niln:
                  niln:
                    datalist.concat(Tai_const.Create_sym(nil));
                    datalist.concat(Tai_const.Create_sym(nil));
@@ -413,17 +413,17 @@ implementation
                               if po_abstractmethod in tprocsym(srsym).first_procdef.procoptions then
                               if po_abstractmethod in tprocsym(srsym).first_procdef.procoptions then
                                 Message(type_e_cant_take_address_of_abstract_method)
                                 Message(type_e_cant_take_address_of_abstract_method)
                               else
                               else
-                                datalist.concat(Tai_const.Createname(tprocsym(srsym).first_procdef.mangledname,AT_FUNCTION,offset));
+                                datalist.concat(Tai_const.Createname(tprocsym(srsym).first_procdef.mangledname,offset));
                             end;
                             end;
                           globalvarsym :
                           globalvarsym :
-                            datalist.concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,AT_DATA,offset));
+                            datalist.concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,offset));
                           typedconstsym :
                           typedconstsym :
-                            datalist.concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset));
+                            datalist.concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,offset));
                           labelsym :
                           labelsym :
-                            datalist.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_LABEL,offset));
+                            datalist.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,offset));
                           constsym :
                           constsym :
                             if tconstsym(srsym).consttyp=constresourcestring then
                             if tconstsym(srsym).consttyp=constresourcestring then
-                              datalist.concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),AT_DATA,tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint)))
+                              datalist.concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint)))
                             else
                             else
                               Message(type_e_variable_id_expected);
                               Message(type_e_variable_id_expected);
                           else
                           else
@@ -441,7 +441,7 @@ implementation
                     if (tinlinenode(p).left.nodetype=typen) then
                     if (tinlinenode(p).left.nodetype=typen) then
                       begin
                       begin
                         datalist.concat(Tai_const.createname(
                         datalist.concat(Tai_const.createname(
-                          tobjectdef(tinlinenode(p).left.resulttype.def).vmt_mangledname,AT_DATA,0));
+                          tobjectdef(tinlinenode(p).left.resulttype.def).vmt_mangledname,0));
                       end
                       end
                     else
                     else
                       Message(parser_e_illegal_expression);
                       Message(parser_e_illegal_expression);
@@ -740,7 +740,7 @@ implementation
                  (tloadnode(p).symtableentry.typ=procsym) then
                  (tloadnode(p).symtableentry.typ=procsym) then
                begin
                begin
                  datalist.concat(Tai_const.createname(
                  datalist.concat(Tai_const.createname(
-                   tprocsym(tloadnode(p).symtableentry).first_procdef.mangledname,AT_FUNCTION,0));
+                   tprocsym(tloadnode(p).symtableentry).first_procdef.mangledname,0));
                end
                end
               else
               else
                Message(parser_e_illegal_expression);
                Message(parser_e_illegal_expression);
@@ -942,7 +942,7 @@ implementation
                                    begin
                                    begin
                                      for i:=1 to vmt_offset-aktpos do
                                      for i:=1 to vmt_offset-aktpos do
                                        datalist.concat(tai_const.create_8bit(0));
                                        datalist.concat(tai_const.create_8bit(0));
-                                     datalist.concat(tai_const.createname(vmt_mangledname,AT_DATA,0));
+                                     datalist.concat(tai_const.createname(vmt_mangledname,0));
                                      { this is more general }
                                      { this is more general }
                                      aktpos:=vmt_offset + sizeof(aint);
                                      aktpos:=vmt_offset + sizeof(aint);
                                    end;
                                    end;
@@ -968,7 +968,7 @@ implementation
                      begin
                      begin
                        for i:=1 to tobjectdef(t.def).vmt_offset-aktpos do
                        for i:=1 to tobjectdef(t.def).vmt_offset-aktpos do
                          datalist.concat(tai_const.create_8bit(0));
                          datalist.concat(tai_const.create_8bit(0));
-                       datalist.concat(tai_const.createname(tobjectdef(t.def).vmt_mangledname,AT_DATA,0));
+                       datalist.concat(tai_const.createname(tobjectdef(t.def).vmt_mangledname,0));
                        { this is more general }
                        { this is more general }
                        aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint);
                        aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint);
                      end;
                      end;

+ 1 - 1
compiler/raatt.pas

@@ -1522,7 +1522,7 @@ unit raatt;
          begin
          begin
            oper.opr.typ:=OPR_SYMBOL;
            oper.opr.typ:=OPR_SYMBOL;
            oper.opr.symofs:=l;
            oper.opr.symofs:=l;
-           oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp);
+           oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr);
          end
          end
         else
         else
          begin
          begin

+ 4 - 4
compiler/rautils.pas

@@ -810,7 +810,7 @@ Begin
           staticsymtable :
           staticsymtable :
             begin
             begin
               initref;
               initref;
-              opr.ref.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA);
+              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tglobalvarsym(sym).mangledname);
             end;
             end;
           parasymtable,
           parasymtable,
           localsymtable :
           localsymtable :
@@ -872,7 +872,7 @@ Begin
     typedconstsym :
     typedconstsym :
       begin
       begin
         initref;
         initref;
-        opr.ref.symbol:=current_asmdata.newasmsymbol(ttypedconstsym(sym).mangledname,AB_EXTERNAL,AT_DATA);
+        opr.ref.symbol:=current_asmdata.RefAsmSymbol(ttypedconstsym(sym).mangledname);
         case ttypedconstsym(sym).typedconsttype.def.deftype of
         case ttypedconstsym(sym).typedconsttype.def.deftype of
           orddef,
           orddef,
           enumdef,
           enumdef,
@@ -920,7 +920,7 @@ Begin
           Message(asmr_w_calling_overload_func);
           Message(asmr_w_calling_overload_func);
         l:=opr.ref.offset;
         l:=opr.ref.offset;
         opr.typ:=OPR_SYMBOL;
         opr.typ:=OPR_SYMBOL;
-        opr.symbol:=current_asmdata.newasmsymbol(tprocsym(sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+        opr.symbol:=current_asmdata.RefAsmSymbol(tprocsym(sym).first_procdef.mangledname);
         opr.symofs:=l;
         opr.symofs:=l;
         hasvar:=true;
         hasvar:=true;
         SetupVar:=TRUE;
         SetupVar:=TRUE;
@@ -1484,7 +1484,7 @@ end;
 
 
   Procedure ConcatConstSymbol(p : TAsmList;const sym:string;symtyp:tasmsymtype;l:aint);
   Procedure ConcatConstSymbol(p : TAsmList;const sym:string;symtyp:tasmsymtype;l:aint);
   begin
   begin
-    p.concat(Tai_const.Createname(sym,symtyp,l));
+    p.concat(Tai_const.Createname(sym,l));
   end;
   end;
 
 
 
 

+ 4 - 4
compiler/sparc/cgcpu.pas

@@ -427,7 +427,7 @@ implementation
 
 
     procedure TCgSparc.a_call_name(list:TAsmList;const s:string);
     procedure TCgSparc.a_call_name(list:TAsmList;const s:string);
       begin
       begin
-        list.concat(taicpu.op_sym(A_CALL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        list.concat(taicpu.op_sym(A_CALL,current_asmdata.RefAsmSymbol(s)));
         { Delay slot }
         { Delay slot }
         list.concat(taicpu.op_none(A_NOP));
         list.concat(taicpu.op_none(A_NOP));
       end;
       end;
@@ -883,7 +883,7 @@ implementation
 
 
     procedure TCgSparc.a_jmp_always(List:TAsmList;l:TAsmLabel);
     procedure TCgSparc.a_jmp_always(List:TAsmList;l:TAsmLabel);
       begin
       begin
-        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION)));
+        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(l.name)));
         { Delay slot }
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
         list.Concat(TAiCpu.Op_none(A_NOP));
       end;
       end;
@@ -891,7 +891,7 @@ implementation
 
 
     procedure tcgsparc.a_jmp_name(list : TAsmList;const s : string);
     procedure tcgsparc.a_jmp_name(list : TAsmList;const s : string);
       begin
       begin
-        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(s)));
         { Delay slot }
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
         list.Concat(TAiCpu.Op_none(A_NOP));
       end;
       end;
@@ -1298,7 +1298,7 @@ implementation
             list.concat(taicpu.op_reg(A_JMP,NR_L1));
             list.concat(taicpu.op_reg(A_JMP,NR_L1));
           end
           end
         else
         else
-          list.concat(taicpu.op_sym(A_BA,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+          list.concat(taicpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(procdef.mangledname)));
         { Delay slot }
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
         list.Concat(TAiCpu.Op_none(A_NOP));
 
 

+ 1 - 1
compiler/sparc/racpugas.pas

@@ -343,7 +343,7 @@ Interface
                 Consume(AS_LPAREN);
                 Consume(AS_LPAREN);
                 BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
                 BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
                 if not assigned(oper.opr.ref.symbol) then
                 if not assigned(oper.opr.ref.symbol) then
-                  oper.opr.ref.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp)
+                  oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
                 else
                 else
                   Message(asmr_e_cant_have_multiple_relocatable_symbols);
                   Message(asmr_e_cant_have_multiple_relocatable_symbols);
                 case oper.opr.typ of
                 case oper.opr.typ of

+ 3 - 3
compiler/symdef.pas

@@ -4732,7 +4732,7 @@ implementation
                   exit;
                   exit;
                 if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then
                 if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then
                   begin
                   begin
-                     current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(proc.procdef).mangledname,AT_FUNCTION,0));
+                     current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(proc.procdef).mangledname,0));
                      typvalue:=1;
                      typvalue:=1;
                   end
                   end
                 else
                 else
@@ -4887,7 +4887,7 @@ implementation
          hp:=tproptablelistitem(proptablelist.first);
          hp:=tproptablelistitem(proptablelist.first);
          while assigned(hp) do
          while assigned(hp) do
            begin
            begin
-              current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(tobjectdef(hp.def).vmt_mangledname,AT_DATA,0));
+              current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(tobjectdef(hp.def).vmt_mangledname,0));
               hp:=tproptablelistitem(hp.next);
               hp:=tproptablelistitem(hp.next);
            end;
            end;
 
 
@@ -4951,7 +4951,7 @@ implementation
                if not(objecttype in [odt_interfacecom,odt_interfacecorba]) then
                if not(objecttype in [odt_interfacecom,odt_interfacecorba]) then
                  begin
                  begin
                    if (oo_has_vmt in objectoptions) then
                    if (oo_has_vmt in objectoptions) then
-                     current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(vmt_mangledname,AT_DATA,0))
+                     current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(vmt_mangledname,0))
                    else
                    else
                      current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil));
                      current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil));
                  end;
                  end;

+ 1 - 1
compiler/symsym.pas

@@ -2338,7 +2338,7 @@ implementation
       begin
       begin
         { the label is always a global label }
         { the label is always a global label }
         if not assigned(lab) then
         if not assigned(lab) then
-         lab:=current_asmdata.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA);
+         lab:=current_asmdata.RefAsmSymbol(mangledname);
         get_label:=lab;
         get_label:=lab;
       end;
       end;
 
 

+ 1 - 1
compiler/systems/t_beos.pas

@@ -167,7 +167,7 @@ begin
            { place jump in al_procedures }
            { place jump in al_procedures }
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;

+ 1 - 1
compiler/systems/t_bsd.pas

@@ -231,7 +231,7 @@ begin
              (target_info.system in [system_i386_freebsd]) then
              (target_info.system in [system_i386_freebsd]) then
              begin
              begin
 {$ifdef x86}
 {$ifdef x86}
-               sym:=current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+               sym:=current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname);
                reference_reset_symbol(r,sym,0);
                reference_reset_symbol(r,sym,0);
                if cs_create_pic in aktmoduleswitches then
                if cs_create_pic in aktmoduleswitches then
                  r.refaddr:=addr_pic
                  r.refaddr:=addr_pic

+ 1 - 1
compiler/systems/t_linux.pas

@@ -179,7 +179,7 @@ begin
              (target_info.system in [system_x86_64_linux,system_i386_linux]) then
              (target_info.system in [system_x86_64_linux,system_i386_linux]) then
              begin
              begin
 {$ifdef x86}
 {$ifdef x86}
-               sym:=current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+               sym:=current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname);
                reference_reset_symbol(r,sym,0);
                reference_reset_symbol(r,sym,0);
                if cs_create_pic in aktmoduleswitches then
                if cs_create_pic in aktmoduleswitches then
                  r.refaddr:=addr_pic
                  r.refaddr:=addr_pic

+ 1 - 1
compiler/systems/t_nwl.pas

@@ -244,7 +244,7 @@ begin
            { place jump in al_procedures }
            { place jump in al_procedures }
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;

+ 1 - 1
compiler/systems/t_nwm.pas

@@ -236,7 +236,7 @@ begin
            { place jump in al_procedures }
            { place jump in al_procedures }
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;

+ 5 - 6
compiler/x86/cgx86.pas

@@ -525,7 +525,7 @@ unit cgx86;
 
 
     procedure tcgx86.a_jmp_name(list : TAsmList;const s : string);
     procedure tcgx86.a_jmp_name(list : TAsmList;const s : string);
       begin
       begin
-        list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+        list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s)));
       end;
       end;
 
 
 
 
@@ -550,7 +550,7 @@ unit cgx86;
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
 
 
         current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
         current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
-        result := current_asmdata.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
+        result := current_asmdata.RefAsmSymbol(stubname);
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT));
@@ -569,7 +569,7 @@ unit cgx86;
 
 
         if (target_info.system <> system_i386_darwin) then
         if (target_info.system <> system_i386_darwin) then
           begin
           begin
-            sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION);
+            sym:=current_asmdata.RefAsmSymbol(s);
             reference_reset_symbol(r,sym,0);
             reference_reset_symbol(r,sym,0);
             if cs_create_pic in aktmoduleswitches then
             if cs_create_pic in aktmoduleswitches then
               begin
               begin
@@ -595,7 +595,7 @@ unit cgx86;
         sym : tasmsymbol;
         sym : tasmsymbol;
         r : treference;
         r : treference;
       begin
       begin
-        sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION);
+        sym:=current_asmdata.RefAsmSymbol(s);
         reference_reset_symbol(r,sym,0);
         reference_reset_symbol(r,sym,0);
         r.refaddr:=addr_full;
         r.refaddr:=addr_full;
         list.concat(taicpu.op_ref(A_CALL,S_NO,r));
         list.concat(taicpu.op_ref(A_CALL,S_NO,r));
@@ -808,8 +808,7 @@ unit cgx86;
                       system_i386_linux:
                       system_i386_linux:
                         if segment=NR_GS then
                         if segment=NR_GS then
                           begin
                           begin
-                            reference_reset_symbol(tmpref,current_asmdata.newasmsymbol(
-                              '___fpc_threadvar_offset',AB_EXTERNAL,AT_DATA),0);
+                            reference_reset_symbol(tmpref,current_asmdata.RefAsmSymbol('___fpc_threadvar_offset'),0);
                             tmpref.segment:=NR_GS;
                             tmpref.segment:=NR_GS;
                             list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r));
                             list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r));
                           end
                           end

+ 2 - 4
compiler/x86/nx86inl.pas

@@ -225,11 +225,9 @@ implementation
              location:=left.location;
              location:=left.location;
              case tfloatdef(resulttype.def).typ of
              case tfloatdef(resulttype.def).typ of
                s32real:
                s32real:
-                 reference_reset_symbol(href,
-                   current_asmdata.newasmsymbol('FPC_ABSMASK_SINGLE',AB_EXTERNAL,AT_DATA),0);
+                 reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_ABSMASK_SINGLE'),0);
                s64real:
                s64real:
-                 reference_reset_symbol(href,
-                   current_asmdata.newasmsymbol('FPC_ABSMASK_DOUBLE',AB_EXTERNAL,AT_DATA),0);
+                 reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_ABSMASK_DOUBLE'),0);
                else
                else
                  internalerror(200506081);
                  internalerror(200506081);
              end;
              end;

+ 1 - 1
compiler/x86_64/cgcpu.pas

@@ -128,7 +128,7 @@ unit cgcpu;
           end
           end
         else
         else
           begin
           begin
-            sym:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION);
+            sym:=current_asmdata.RefAsmSymbol(procdef.mangledname);
             reference_reset_symbol(r,sym,0);
             reference_reset_symbol(r,sym,0);
             if cs_create_pic in aktmoduleswitches then
             if cs_create_pic in aktmoduleswitches then
               r.refaddr:=addr_pic
               r.refaddr:=addr_pic