Browse Source

- removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
* explicitly pass the correct value for all calls to those methods elsewhere
in the compiler

git-svn-id: trunk@34250 -

Jonas Maebe 9 years ago
parent
commit
aa1be3276f
62 changed files with 170 additions and 165 deletions
  1. 4 4
      compiler/aarch64/cgcpu.pas
  2. 1 1
      compiler/aarch64/racpugas.pas
  3. 3 3
      compiler/aasmdata.pas
  4. 5 5
      compiler/arm/cgcpu.pas
  5. 3 3
      compiler/arm/hlcgcpu.pas
  6. 1 1
      compiler/arm/raarmgas.pas
  7. 4 4
      compiler/avr/cgcpu.pas
  8. 6 6
      compiler/avr/navrutil.pas
  9. 2 2
      compiler/avr/raavrgas.pas
  10. 7 2
      compiler/cgobj.pas
  11. 3 3
      compiler/dbgdwarf.pas
  12. 1 1
      compiler/dbgstabx.pas
  13. 1 1
      compiler/hlcgobj.pas
  14. 1 1
      compiler/i386/cgcpu.pas
  15. 1 1
      compiler/i386/hlcgcpu.pas
  16. 5 5
      compiler/i386/n386flw.pas
  17. 3 3
      compiler/i8086/cgcpu.pas
  18. 1 1
      compiler/i8086/hlcgcpu.pas
  19. 8 8
      compiler/i8086/n8086ld.pas
  20. 11 11
      compiler/jvm/hlcgcpu.pas
  21. 2 2
      compiler/jvm/njvmcal.pas
  22. 1 1
      compiler/jvm/njvmcnv.pas
  23. 1 1
      compiler/jvm/njvmcon.pas
  24. 2 2
      compiler/jvm/njvmmem.pas
  25. 2 2
      compiler/jvm/njvmutil.pas
  26. 4 4
      compiler/jvm/tgcpu.pas
  27. 1 1
      compiler/llvm/hlcgllvm.pas
  28. 3 3
      compiler/m68k/cgcpu.pas
  29. 1 1
      compiler/m68k/hlcgcpu.pas
  30. 1 1
      compiler/m68k/ra68kmot.pas
  31. 5 5
      compiler/mips/cgcpu.pas
  32. 6 6
      compiler/mips/hlcgcpu.pas
  33. 2 2
      compiler/mips/racpugas.pas
  34. 1 1
      compiler/ncgld.pas
  35. 1 1
      compiler/ncgmem.pas
  36. 8 8
      compiler/objcgutl.pas
  37. 2 2
      compiler/powerpc/cgcpu.pas
  38. 1 1
      compiler/powerpc/nppccal.pas
  39. 1 1
      compiler/powerpc/rappcgas.pas
  40. 3 3
      compiler/powerpc64/cgcpu.pas
  41. 1 1
      compiler/powerpc64/rappcgas.pas
  42. 8 8
      compiler/ppcgen/cgppc.pas
  43. 2 2
      compiler/ppcgen/hlcgppc.pas
  44. 2 2
      compiler/raatt.pas
  45. 4 4
      compiler/rautils.pas
  46. 5 5
      compiler/sparc/cgcpu.pas
  47. 1 1
      compiler/sparc/hlcgcpu.pas
  48. 2 2
      compiler/sparc/racpugas.pas
  49. 1 1
      compiler/systems/t_beos.pas
  50. 1 1
      compiler/systems/t_haiku.pas
  51. 1 1
      compiler/systems/t_nwl.pas
  52. 1 1
      compiler/systems/t_nwm.pas
  53. 3 3
      compiler/systems/t_win.pas
  54. 6 6
      compiler/x86/cgx86.pas
  55. 1 1
      compiler/x86/hlcgx86.pas
  56. 2 2
      compiler/x86/nx86inl.pas
  57. 1 1
      compiler/x86/rax86.pas
  58. 2 2
      compiler/x86/rax86att.pas
  59. 3 3
      compiler/x86/rax86int.pas
  60. 1 1
      compiler/x86_64/hlcgcpu.pas
  61. 2 2
      compiler/x86_64/nx64cal.pas
  62. 1 1
      compiler/x86_64/nx64flw.pas

+ 4 - 4
compiler/aarch64/cgcpu.pas

@@ -561,9 +561,9 @@ implementation
     procedure tcgaarch64.a_call_name(list: TAsmList; const s: string; weak: boolean);
       begin
         if not weak then
-          list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)))
+          list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s,AT_FUNCTION)))
         else
-          list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol(s)));
+          list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)));
       end;
 
 
@@ -1438,7 +1438,7 @@ implementation
       var
         ai: taicpu;
       begin
-        ai:=TAiCpu.op_sym(A_B,current_asmdata.RefAsmSymbol(l.name));
+        ai:=TAiCpu.op_sym(A_B,current_asmdata.RefAsmSymbol(l.name,AT_FUNCTION));
         ai.is_jmp:=true;
         list.Concat(ai);
       end;
@@ -1448,7 +1448,7 @@ implementation
       var
         ai: taicpu;
       begin
-        ai:=TAiCpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s));
+        ai:=TAiCpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
         ai.is_jmp:=true;
         list.Concat(ai);
       end;

+ 1 - 1
compiler/aarch64/racpugas.pas

@@ -620,7 +620,7 @@ Unit racpugas;
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);

+ 3 - 3
compiler/aasmdata.pas

@@ -174,8 +174,8 @@ interface
         { asmsymbol }
         function  DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef) : TAsmSymbol; virtual;
         function  DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef) : TAsmSymbol;
-        function  WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE) : TAsmSymbol;
-        function  RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE;indirect:boolean=false) : TAsmSymbol;
+        function  WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
+        function  RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean=false) : TAsmSymbol;
         function  GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
         { create new assembler label }
         procedure getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
@@ -500,7 +500,7 @@ implementation
       end;
 
 
-    function TAsmData.WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE) : TAsmSymbol;
+    function TAsmData.WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
       begin
         result:=TAsmSymbol(FAsmSymbolDict.Find(s));
         if not assigned(result) then

+ 5 - 5
compiler/arm/cgcpu.pas

@@ -655,9 +655,9 @@ unit cgcpu;
           generating BL is also what clang and gcc do by default }
           branchopcode:=A_BL;
         if not(weak) then
-          sym:=current_asmdata.RefAsmSymbol(s)
+          sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION)
         else
-          sym:=current_asmdata.WeakRefAsmSymbol(s);
+          sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION);
         reference_reset_symbol(r,sym,0,sizeof(pint));
 
         if (tf_pic_uses_got in target_info.flags) and
@@ -1813,9 +1813,9 @@ unit cgcpu;
       begin
         { generate far jump, leave it to the optimizer to get rid of it }
         if GenerateThumbCode then
-          ai:=taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s))
+          ai:=taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s,AT_FUNCTION))
         else
-          ai:=taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s));
+          ai:=taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
         ai.is_jmp:=true;
         list.concat(ai);
       end;
@@ -2370,7 +2370,7 @@ unit cgcpu;
             ref.symboldata:=current_procinfo.aktlocaldata.last;
             list.concat(Taicpu.op_reg_ref(A_LDR,NR_R12,ref));
             current_asmdata.getaddrlabel(l);
-            current_procinfo.aktlocaldata.concat(tai_const.Create_rel_sym_offset(aitconst_32bit,l,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),-8));
+            current_procinfo.aktlocaldata.concat(tai_const.Create_rel_sym_offset(aitconst_32bit,l,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_',AT_DATA),-8));
             cg.a_label(list,l);
             list.concat(Taicpu.op_reg_reg_reg(A_ADD,NR_R12,NR_PC,NR_R12));
             list.concat(Taicpu.op_reg_reg(A_MOV,current_procinfo.got,NR_R12));

+ 3 - 3
compiler/arm/hlcgcpu.pas

@@ -208,7 +208,7 @@ implementation
           current_procinfo.aktlocaldata.Concat(tai_align.Create(4));
           cg.a_label(current_procinfo.aktlocaldata,l);
           tmpref.symboldata:=current_procinfo.aktlocaldata.last;
-          current_procinfo.aktlocaldata.concat(tai_const.Create_sym(current_asmdata.RefAsmSymbol(procdef.mangledname)));
+          current_procinfo.aktlocaldata.concat(tai_const.Create_sym(current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)));
 
           tmpref.symbol:=l;
           tmpref.base:=NR_PC;
@@ -218,7 +218,7 @@ implementation
           list.concat(taicpu.op_reg(A_BX,NR_R12));
         end
       else
-        list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
+        list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)));
       list.concatlist(current_procinfo.aktlocaldata);
 
       current_procinfo.Free;
@@ -252,7 +252,7 @@ implementation
       { append const entry }
       list.Concat(tai_align.Create(4));
       list.Concat(tai_label.create(l));
-      list.concat(tai_const.Create_sym(current_asmdata.RefAsmSymbol(externalname)));
+      list.concat(tai_const.Create_sym(current_asmdata.RefAsmSymbol(externalname,AT_FUNCTION)));
     end;
 
 

+ 1 - 1
compiler/arm/raarmgas.pas

@@ -647,7 +647,7 @@ Unit raarmgas;
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);

+ 4 - 4
compiler/avr/cgcpu.pas

@@ -406,9 +406,9 @@ unit cgcpu;
         sym: TAsmSymbol;
       begin
         if weak then
-          sym:=current_asmdata.WeakRefAsmSymbol(s)
+          sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)
         else
-          sym:=current_asmdata.RefAsmSymbol(s);
+          sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION);
 
         if CPUAVR_HAS_JMP_CALL in cpu_capabilities[current_settings.cputype] then
           list.concat(taicpu.op_sym(A_CALL,sym))
@@ -1674,9 +1674,9 @@ unit cgcpu;
         ai : taicpu;
       begin
         if CPUAVR_HAS_JMP_CALL in cpu_capabilities[current_settings.cputype] then
-          ai:=taicpu.op_sym(A_JMP,current_asmdata.RefAsmSymbol(s))
+          ai:=taicpu.op_sym(A_JMP,current_asmdata.RefAsmSymbol(s,AT_FUNCTION))
         else
-          ai:=taicpu.op_sym(A_RJMP,current_asmdata.RefAsmSymbol(s));
+          ai:=taicpu.op_sym(A_RJMP,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
         ai.is_jmp:=true;
         list.concat(ai);
       end;

+ 6 - 6
compiler/avr/navrutil.pas

@@ -89,14 +89,14 @@ implementation
             pd:=tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_constructor);
             if assigned(pd) then
               begin
-                InitList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(pd.mangledname)));
+                InitList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
                 inc(initCount);
               end;
 
             pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_destructor);
             if assigned(pd) then
               begin
-                FinalizeList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(pd.mangledname)));
+                FinalizeList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
                 inc(finalCount);
               end;
           end;
@@ -127,13 +127,13 @@ implementation
             begin
               if (hp.u.flags and uf_init)<>0 then
                 begin
-                  initList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('INIT$',hp.u.globalsymtable,''))));
+                  initList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('INIT$',hp.u.globalsymtable,''),AT_DATA)));
                   inc(initCount);
                 end;
 
               if (hp.u.flags and uf_finalize)<>0 then
                 begin
-                  finalList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('FINALIZE$',hp.u.globalsymtable,''))));
+                  finalList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('FINALIZE$',hp.u.globalsymtable,''),AT_DATA)));
                   inc(finalCount);
                 end;
             end;
@@ -150,13 +150,13 @@ implementation
         begin
           if (current_module.flags and uf_init)<>0 then
             begin
-              initList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('INIT$',current_module.localsymtable,''))));
+              initList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('INIT$',current_module.localsymtable,''),AT_DATA)));
               inc(initCount);
             end;
 
           if (current_module.flags and uf_finalize)<>0 then
             begin
-              finalList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('FINALIZE$',current_module.localsymtable,''))));
+              finalList.Concat(taicpu.op_sym(op,current_asmdata.RefAsmSymbol(make_mangledname('FINALIZE$',current_module.localsymtable,''),AT_DATA)));
               inc(finalCount);
             end;
         end;

+ 2 - 2
compiler/avr/raavrgas.pas

@@ -271,7 +271,7 @@ Unit raavrgas;
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);
@@ -398,7 +398,7 @@ Unit raavrgas;
                   Consume(AS_LPAREN);
                   BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
                   if not assigned(oper.opr.ref.symbol) then
-                    oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
+                    oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp)
                   else
                     Message(asmr_e_cant_have_multiple_relocatable_symbols);
                   case oper.opr.typ of

+ 7 - 2
compiler/cgobj.pas

@@ -2378,6 +2378,7 @@ implementation
         l: tasmsymbol;
         ref: treference;
         nlsymname: string;
+        symtyp: TAsmsymtype;
       begin
         result := NR_NO;
         case target_info.system of
@@ -2391,13 +2392,17 @@ implementation
               l:=current_asmdata.getasmsymbol(nlsymname);
               if not(assigned(l)) then
                 begin
+                  if is_data in flags then
+                    symtyp:=AT_DATA
+                  else
+                    symtyp:=AT_FUNCTION;
                   new_section(current_asmdata.asmlists[al_picdata],sec_data_nonlazy,'',sizeof(pint));
                   l:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA,voidpointertype);
                   current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(l,0));
                   if not(is_weak in flags) then
-                    current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_indirect_symbol,current_asmdata.RefAsmSymbol(symname).Name))
+                    current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_indirect_symbol,current_asmdata.RefAsmSymbol(symname,symtyp).Name))
                   else
-                    current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_indirect_symbol,current_asmdata.WeakRefAsmSymbol(symname).Name));
+                    current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_indirect_symbol,current_asmdata.WeakRefAsmSymbol(symname,symtyp).Name));
 {$ifdef cpu64bitaddr}
                   current_asmdata.asmlists[al_picdata].concat(tai_const.create_64bit(0));
 {$else cpu64bitaddr}

+ 3 - 3
compiler/dbgdwarf.pas

@@ -2229,15 +2229,15 @@ implementation
             else
               procentry := def.mangledname;
 
-            append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry));
+            append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION));
             append_labelentry(DW_AT_high_pc,procendlabel);
 
             if not(target_info.system in systems_darwin) then
               begin
                 current_asmdata.asmlists[al_dwarf_aranges].Concat(
-                  tai_const.create_type_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry)));
+                  tai_const.create_type_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION)));
                 current_asmdata.asmlists[al_dwarf_aranges].Concat(
-                  tai_const.Create_rel_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry),procendlabel));
+                  tai_const.Create_rel_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION),procendlabel));
               end;
           end;
 

+ 1 - 1
compiler/dbgstabx.pas

@@ -276,7 +276,7 @@ implementation
       ismem:=not(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_MMREGISTER,LOC_CMMREGISTER,LOC_FPUREGISTER,LOC_CFPUREGISTER]);
       isglobal:=false;
       if ismem then
-        isglobal:=current_asmdata.RefAsmSymbol(sym.mangledname).bind=AB_GLOBAL;
+        isglobal:=current_asmdata.RefAsmSymbol(sym.mangledname,AT_DATA).bind=AB_GLOBAL;
 
       { put extra ss/es markers in place }
       if ismem then

+ 1 - 1
compiler/hlcgobj.pas

@@ -4714,7 +4714,7 @@ implementation
              begin
                { initialize fpu regvar by loading from memory }
                reference_reset_symbol(href,
-                 current_asmdata.RefAsmSymbol(tstaticvarsym(p).mangledname), 0,
+                 current_asmdata.RefAsmSymbol(tstaticvarsym(p).mangledname,AT_DATA), 0,
                  var_align(tstaticvarsym(p).vardef.alignment));
                a_loadfpu_ref_reg(TAsmList(arg), tstaticvarsym(p).vardef,
                  tstaticvarsym(p).vardef, href, tstaticvarsym(p).initialloc.register);

+ 1 - 1
compiler/i386/cgcpu.pas

@@ -571,7 +571,7 @@ unit cgcpu;
                     current_module.requires_ecx_pic_helper:=true;
                     a_call_name_static(list,'fpc_geteipasecx');
                   end;
-                list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),0,tmpreg));
+                list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_',AT_DATA),0,tmpreg));
                 list.concat(taicpu.op_reg_reg(A_MOV,S_L,tmpreg,current_procinfo.got));
 
                 { Deallocate parameter registers }

+ 1 - 1
compiler/i386/hlcgcpu.pas

@@ -432,7 +432,7 @@ implementation
         begin
           if (target_info.system <> system_i386_darwin) then
             begin
-              lab:=current_asmdata.RefAsmSymbol(procdef.mangledname);
+              lab:=current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION);
               list.concat(taicpu.op_sym(A_JMP,S_NO,lab))
             end
           else

+ 5 - 5
compiler/i386/n386flw.pas

@@ -359,14 +359,14 @@ procedure ti386tryfinallynode.pass_generate_code;
 
         current_asmdata.getjumplabel(exceptlabel);
         emit_scope_start(
-          current_asmdata.RefAsmSymbol('__FPC_except_safecall'),
+          current_asmdata.RefAsmSymbol('__FPC_except_safecall',AT_FUNCTION),
           exceptlabel
         );
       end
     else
       emit_scope_start(
-        current_asmdata.RefAsmSymbol('__FPC_finally_handler'),
-        current_asmdata.RefAsmSymbol(finalizepi.procdef.mangledname)
+        current_asmdata.RefAsmSymbol('__FPC_finally_handler',AT_FUNCTION),
+        current_asmdata.RefAsmSymbol(finalizepi.procdef.mangledname,AT_FUNCTION)
       );
 
     { try code }
@@ -537,12 +537,12 @@ procedure ti386tryexceptnode.pass_generate_code;
       begin
         current_asmdata.getaddrlabel(filterlabel);
         emit_scope_start(
-          current_asmdata.RefAsmSymbol('__FPC_on_handler'),
+          current_asmdata.RefAsmSymbol('__FPC_on_handler',AT_FUNCTION),
           filterlabel);
       end
     else
       emit_scope_start(
-        current_asmdata.RefAsmSymbol('__FPC_except_handler'),
+        current_asmdata.RefAsmSymbol('__FPC_except_handler',AT_FUNCTION),
         exceptlabel);
 
     { set control flow labels for the try block }

+ 3 - 3
compiler/i8086/cgcpu.pas

@@ -190,9 +190,9 @@ unit cgcpu;
         sym : tasmsymbol;
       begin
         if not(weak) then
-          sym:=current_asmdata.RefAsmSymbol(s)
+          sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION)
         else
-          sym:=current_asmdata.WeakRefAsmSymbol(s);
+          sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION);
         list.concat(taicpu.op_sym(A_CALL,S_FAR,sym));
       end;
 
@@ -210,7 +210,7 @@ unit cgcpu;
       var
         sym : tasmsymbol;
       begin
-        sym:=current_asmdata.RefAsmSymbol(s);
+        sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION);
         list.concat(taicpu.op_sym(A_CALL,S_FAR,sym));
       end;
 

+ 1 - 1
compiler/i8086/hlcgcpu.pas

@@ -658,7 +658,7 @@ implementation
       { case 0 }
       else
         begin
-          lab:=current_asmdata.RefAsmSymbol(procdef.mangledname);
+          lab:=current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION);
 
           if current_settings.x86memorymodel in x86_far_code_models then
             list.concat(taicpu.op_sym(A_JMP,S_FAR,lab))

+ 8 - 8
compiler/i8086/n8086ld.pas

@@ -139,18 +139,18 @@ implementation
             paramanager.getintparaloc(current_asmdata.CurrAsmList,tprocvardef(pvd),1,paraloc1);
             hregister:=hlcg.getaddressregister(current_asmdata.CurrAsmList,pvd);
             segreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
-            reference_reset_symbol(segref,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE'),0,0);
+            reference_reset_symbol(segref,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,0);
             segref.refaddr:=addr_seg;
             cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_16,OS_16,segref,segreg);
-            reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE'),0,pvd.size);
+            reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,pvd.size);
             href.segment:=segreg;
             hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,pvd,pvd,href,hregister);
             hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,pvd,OC_EQ,0,hregister,norelocatelab);
             { don't save the allocated register else the result will be destroyed later }
             if not(vo_is_weak_external in gvs.varoptions) then
-              reference_reset_symbol(href,current_asmdata.RefAsmSymbol(gvs.mangledname),0,sizeof(pint))
+              reference_reset_symbol(href,current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA),0,sizeof(pint))
             else
-              reference_reset_symbol(href,current_asmdata.WeakRefAsmSymbol(gvs.mangledname),0,sizeof(pint));
+              reference_reset_symbol(href,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),0,sizeof(pint));
             cg.a_load_ref_cgpara(current_asmdata.CurrAsmList,OS_16,href,paraloc1);
             paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
             paraloc1.done;
@@ -168,9 +168,9 @@ implementation
                 0 - Threadvar index
                 4 - Threadvar value in single threading }
             if not(vo_is_weak_external in gvs.varoptions) then
-              reference_reset_symbol(href,current_asmdata.RefAsmSymbol(gvs.mangledname),sizeof(pint),sizeof(pint))
+              reference_reset_symbol(href,current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA),sizeof(pint),sizeof(pint))
             else
-              reference_reset_symbol(href,current_asmdata.WeakRefAsmSymbol(gvs.mangledname),sizeof(pint),sizeof(pint));
+              reference_reset_symbol(href,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),sizeof(pint),sizeof(pint));
             hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,resultdef,voidpointertype,href,hregister);
             cg.a_label(current_asmdata.CurrAsmList,endrelocatelab);
             hlcg.reference_reset_base(location.reference,voidpointertype,hregister,0,location.reference.alignment);
@@ -223,9 +223,9 @@ implementation
                       if gvs.localloc.loc=LOC_INVALID then
                         begin
                           if not(vo_is_weak_external in gvs.varoptions) then
-                            refsym:=current_asmdata.RefAsmSymbol(gvs.mangledname)
+                            refsym:=current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA)
                           else
-                            refsym:=current_asmdata.WeakRefAsmSymbol(gvs.mangledname);
+                            refsym:=current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA);
 
                           segreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
 

+ 11 - 11
compiler/jvm/hlcgcpu.pas

@@ -665,7 +665,7 @@ implementation
         begin
           { multianewarray typedesc ndim }
           list.concat(taicpu.op_sym_const(a_multianewarray,
-            current_asmdata.RefAsmSymbol(jvmarrtype(elemdef,primitivetype)),initdim));
+            current_asmdata.RefAsmSymbol(jvmarrtype(elemdef,primitivetype),AT_METADATA),initdim));
           { has to be a multi-dimensional array type }
           if primitivetype then
             internalerror(2011012207);
@@ -684,7 +684,7 @@ implementation
             opc:=a_newarray
           else
             opc:=a_anewarray;
-          list.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(mangledname)));
+          list.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(mangledname,AT_METADATA)));
         end;
       { all dimensions are removed from the stack, an array reference is
         added }
@@ -1325,7 +1325,7 @@ implementation
 
   procedure thlcgjvm.a_jmp_always(list: TAsmList; l: tasmlabel);
     begin
-      list.concat(taicpu.op_sym(a_goto,current_asmdata.RefAsmSymbol(l.name)));
+      list.concat(taicpu.op_sym(a_goto,current_asmdata.RefAsmSymbol(l.name,AT_METADATA)));
     end;
 
   procedure thlcgjvm.concatcopy_normal_array(list: TAsmList; size: tdef; const source, dest: treference);
@@ -2294,7 +2294,7 @@ implementation
     var
       tmpref: treference;
     begin
-      ref.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname);
+      ref.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname,AT_DATA);
       tg.gethltemp(list,vs.vardef,vs.vardef.size,tt_persistent,tmpref);
       { only copy the reference, not the actual data }
       a_load_ref_ref(list,java_jlobject,java_jlobject,tmpref,ref);
@@ -2306,7 +2306,7 @@ implementation
 
   procedure thlcgjvm.allocate_enum_with_base_ref(list: TAsmList; vs: tabstractvarsym; const initref: treference; destbaseref: treference);
     begin
-      destbaseref.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname);
+      destbaseref.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname,AT_DATA);
       { only copy the reference, not the actual data }
       a_load_ref_ref(list,java_jlobject,java_jlobject,initref,destbaseref);
     end;
@@ -2321,7 +2321,7 @@ implementation
       { no enum with ordinal value 0 -> exit }
       if not assigned(sym) then
         exit;
-      reference_reset_symbol(ref,current_asmdata.RefAsmSymbol(sym.mangledname),0,4);
+      reference_reset_symbol(ref,current_asmdata.RefAsmSymbol(sym.mangledname,AT_DATA),0,4);
       result:=true;
     end;
 
@@ -2449,11 +2449,11 @@ implementation
       else if is_shortstring(checkdef) then
         checkdef:=java_shortstring;
       if checkdef.typ in [objectdef,recorddef] then
-        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol(tabstractrecorddef(checkdef).jvm_full_typename(true))))
+        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol(tabstractrecorddef(checkdef).jvm_full_typename(true),AT_METADATA)))
       else if checkdef.typ=classrefdef then
-        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol('java/lang/Class')))
+        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol('java/lang/Class',AT_METADATA)))
       else
-        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol(jvmencodetype(checkdef,false))));
+        list.concat(taicpu.op_sym(checkop,current_asmdata.RefAsmSymbol(jvmencodetype(checkdef,false),AT_METADATA)));
     end;
 
   procedure thlcgjvm.resizestackfpuval(list: TAsmList; fromsize, tosize: tcgsize);
@@ -2544,11 +2544,11 @@ implementation
           internalerror(2010122602);
       end;
       if (opc<>a_invokeinterface) then
-        list.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(s)))
+        list.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(s,AT_FUNCTION)))
       else
         begin
           pd.init_paraloc_info(calleeside);
-          list.concat(taicpu.op_sym_const(opc,current_asmdata.RefAsmSymbol(s),pd.calleeargareasize));
+          list.concat(taicpu.op_sym_const(opc,current_asmdata.RefAsmSymbol(s,AT_FUNCTION),pd.calleeargareasize));
         end;
       result:=get_call_result_cgpara(pd,forceresdef);
     end;

+ 2 - 2
compiler/jvm/njvmcal.pas

@@ -65,7 +65,7 @@ implementation
       verbose,globals,globtype,constexp,cutils,
       symconst,symtable,symsym,symcpu,defutil,
       cgutils,tgobj,procinfo,htypechk,
-      cpubase,aasmdata,aasmcpu,
+      cpubase,aasmbase,aasmdata,aasmcpu,
       hlcgobj,hlcgcpu,
       pass_1,nutils,nadd,nbas,ncnv,ncon,nflw,ninl,nld,nmem,
       jvmdef;
@@ -406,7 +406,7 @@ implementation
         if (current_procinfo.procdef.proctypeoption=potype_constructor) and
            (cnf_inherited in callnodeflags) then
           exit;
-        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(tabstractrecorddef(procdefinition.owner.defowner).jvm_full_typename(true))));
+        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(tabstractrecorddef(procdefinition.owner.defowner).jvm_full_typename(true),AT_METADATA)));
         { the constructor doesn't return anything, so put a duplicate of the
           self pointer on the evaluation stack for use as function result
           after the constructor has run }

+ 1 - 1
compiler/jvm/njvmcnv.pas

@@ -826,7 +826,7 @@ implementation
         else
           opc:=a_anewarray;
         { doesn't change stack height: one int replaced by one reference }
-        current_asmdata.CurrAsmList.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(mangledname)));
+        current_asmdata.CurrAsmList.concat(taicpu.op_sym(opc,current_asmdata.RefAsmSymbol(mangledname,AT_METADATA)));
         { store the data in the newly created array }
         basereg:=hlcg.getaddressregister(current_asmdata.CurrAsmList,java_jlobject);
         thlcgjvm(hlcg).a_load_stack_reg(current_asmdata.CurrAsmList,java_jlobject,basereg);

+ 1 - 1
compiler/jvm/njvmcon.pas

@@ -451,7 +451,7 @@ implementation
         current_module.localsymtable.insert(csym);
         { generate assignment of the constant to the typed constant symbol }
         ssym:=jvm_add_typed_const_initializer(csym);
-        result:=current_asmdata.RefAsmSymbol(ssym.mangledname);
+        result:=current_asmdata.RefAsmSymbol(ssym.mangledname,AT_DATA);
       end;
 
 

+ 2 - 2
compiler/jvm/njvmmem.pas

@@ -147,7 +147,7 @@ implementation
                (location.reference.index<>NR_NO) or
                assigned(location.reference.symbol) then
               internalerror(2011011301);
-            location.reference.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname);
+            location.reference.symbol:=current_asmdata.RefAsmSymbol(vs.mangledname,AT_METADATA);
             result:=true;
           end
       end;
@@ -346,7 +346,7 @@ implementation
     procedure tjvmloadvmtaddrnode.pass_generate_code;
       begin
         current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_ldc,current_asmdata.RefAsmSymbol(
-          tabstractrecorddef(tclassrefdef(resultdef).pointeddef).jvm_full_typename(true))));
+          tabstractrecorddef(tclassrefdef(resultdef).pointeddef).jvm_full_typename(true),AT_METADATA)));
         thlcgjvm(hlcg).incstack(current_asmdata.CurrAsmList,1);
         location_reset(location,LOC_REGISTER,OS_ADDR);
         location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);

+ 2 - 2
compiler/jvm/njvmutil.pas

@@ -62,7 +62,7 @@ implementation
 
     uses
       verbose,cutils,globtype,globals,constexp,fmodule,
-      aasmdata,aasmtai,cpubase,aasmcpu,
+      aasmdata,aasmtai,cpubase,aasmbase,aasmcpu,
       symbase,symcpu,symtable,defutil,jvmdef,
       ncnv,ncon,ninl,ncal,nld,nmem,
       ppu,
@@ -405,7 +405,7 @@ implementation
                   replace(unitclassname,'.','/');
                 end;
               unitclassname:=unitclassname+hp.u.realmodulename^;
-              unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname)));
+              unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname,AT_METADATA)));
               unitinits.concat(taicpu.op_none(a_pop));
             end;
           hp:=tused_unit(hp.next);

+ 4 - 4
compiler/jvm/tgcpu.pas

@@ -56,7 +56,7 @@ unit tgcpu;
        verbose,
        cgbase,
        symconst,symtable,symdef,symsym,symcpu,defutil,
-       cpubase,aasmcpu,
+       cpubase,aasmbase,aasmcpu,
        hlcgobj,hlcgcpu;
 
 
@@ -68,7 +68,7 @@ unit tgcpu;
         pd: tprocdef;
       begin
         gettemp(list,java_jlobject.size,java_jlobject.alignment,temptype,ref);
-        list.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(tabstractrecorddef(def).jvm_full_typename(true))));
+        list.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(tabstractrecorddef(def).jvm_full_typename(true),AT_METADATA)));
         { the constructor doesn't return anything, so put a duplicate of the
           self pointer on the evaluation stack for use as function result
           after the constructor has run }
@@ -135,7 +135,7 @@ unit tgcpu;
               if tsetdef(def).elementdef.typ=enumdef then
                 begin
                   { load enum class type }
-                  list.concat(taicpu.op_sym(a_ldc,current_asmdata.RefAsmSymbol(tcpuenumdef(tenumdef(tsetdef(def).elementdef).getbasedef).classdef.jvm_full_typename(true))));
+                  list.concat(taicpu.op_sym(a_ldc,current_asmdata.RefAsmSymbol(tcpuenumdef(tenumdef(tsetdef(def).elementdef).getbasedef).classdef.jvm_full_typename(true),AT_METADATA)));
                   thlcgjvm(hlcg).incstack(current_asmdata.CurrAsmList,1);
                   { call tenumset.noneOf() class method }
                   sym:=tsym(tobjectdef(java_juenumset).symtable.find('NONEOF'));
@@ -152,7 +152,7 @@ unit tgcpu;
                 end
               else
                 begin
-                  list.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(java_jubitset.jvm_full_typename(true))));
+                  list.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(java_jubitset.jvm_full_typename(true),AT_METADATA)));
                   { the constructor doesn't return anything, so put a duplicate of the
                     self pointer on the evaluation stack for use as function result
                     after the constructor has run }

+ 1 - 1
compiler/llvm/hlcgllvm.pas

@@ -518,7 +518,7 @@ implementation
       res: tregister;
     begin
       a_call_common(list,pd,paras,forceresdef,res,hlretdef,llvmretdef,callparas);
-      list.concat(taillvm.call_size_name_paras(get_call_pd(pd),res,llvmretdef,current_asmdata.RefAsmSymbol(s),callparas));
+      list.concat(taillvm.call_size_name_paras(get_call_pd(pd),res,llvmretdef,current_asmdata.RefAsmSymbol(s,AT_FUNCTION),callparas));
       result:=get_call_result_cgpara(pd,forceresdef);
       set_call_function_result(list,pd,llvmretdef,hlretdef,res,result);
     end;

+ 3 - 3
compiler/m68k/cgcpu.pas

@@ -602,9 +602,9 @@ unit cgcpu;
         sym: tasmsymbol;
       begin
         if not(weak) then
-          sym:=current_asmdata.RefAsmSymbol(s)
+          sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION)
         else
-          sym:=current_asmdata.WeakRefAsmSymbol(s);
+          sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION);
 
         list.concat(taicpu.op_sym(A_JSR,S_NO,sym));
       end;
@@ -1599,7 +1599,7 @@ unit cgcpu;
       var
        ai: taicpu;
       begin
-         ai := Taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s));
+         ai := Taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
          ai.is_jmp := true;
          list.concat(ai);
       end;

+ 1 - 1
compiler/m68k/hlcgcpu.pas

@@ -187,7 +187,7 @@ implementation
         end
       { case 0 }
       else
-        list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(procdef.mangledname)));
+        list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)));
 
       List.concat(Tai_symbol_end.Createname(labelname));
     end;

+ 1 - 1
compiler/m68k/ra68kmot.pas

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

+ 5 - 5
compiler/mips/cgcpu.pas

@@ -387,9 +387,9 @@ begin
     InternalError(2013022101);
 
   if weak then
-    sym:=current_asmdata.WeakRefAsmSymbol(s)
+    sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)
   else
-    sym:=current_asmdata.RefAsmSymbol(s);
+    sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION);
 
   if (cs_create_pic in current_settings.moduleswitches) then
     a_call_sym_pic(list,sym)
@@ -1069,7 +1069,7 @@ end;
 
 procedure TCGMIPS.a_jmp_name(list: tasmlist; const s: string);
 begin
-  List.Concat(TAiCpu.op_sym(A_BA, current_asmdata.RefAsmSymbol(s)));
+  List.Concat(TAiCpu.op_sym(A_BA, current_asmdata.RefAsmSymbol(s,AT_FUNCTION)));
   { Delay slot }
   list.Concat(TAiCpu.Op_none(A_NOP));
 end;
@@ -1666,12 +1666,12 @@ procedure TCGMIPS.g_profilecode(list:TAsmList);
   begin
     if not (cs_create_pic in current_settings.moduleswitches) then
       begin
-        reference_reset_symbol(href,current_asmdata.RefAsmSymbol('_gp'),0,sizeof(pint));
+        reference_reset_symbol(href,current_asmdata.RefAsmSymbol('_gp',AT_DATA),0,sizeof(pint));
         a_loadaddr_ref_reg(list,href,NR_GP);
       end;
     list.concat(taicpu.op_reg_reg(A_MOVE,NR_R1,NR_RA));
     list.concat(taicpu.op_reg_reg_const(A_ADDIU,NR_SP,NR_SP,-8));
-    a_call_sym_pic(list,current_asmdata.RefAsmSymbol('_mcount'));
+    a_call_sym_pic(list,current_asmdata.RefAsmSymbol('_mcount',AT_FUNCTION));
   end;
 
 

+ 6 - 6
compiler/mips/hlcgcpu.pas

@@ -67,15 +67,15 @@ implementation
       sym: tasmsymbol;
     begin
       if weak then
-        sym:=current_asmdata.WeakRefAsmSymbol(s)
+        sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)
       else
-        sym:=current_asmdata.RefAsmSymbol(s);
+        sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION);
 
       if (po_external in pd.procoptions) then
         begin
           if not (cs_create_pic in current_settings.moduleswitches) then
             begin
-              reference_reset_symbol(ref,current_asmdata.RefAsmSymbol('_gp'),0,sizeof(aint));
+              reference_reset_symbol(ref,current_asmdata.RefAsmSymbol('_gp',AT_DATA),0,sizeof(aint));
               list.concat(tai_comment.create(strpnew('Using PIC code for a_call_name')));
               cg.a_loadaddr_ref_reg(list,ref,NR_GP);
             end;
@@ -152,7 +152,7 @@ implementation
     var
       href: treference;
     begin
-      reference_reset_symbol(href,current_asmdata.RefAsmSymbol(externalname),0,sizeof(aint));
+      reference_reset_symbol(href,current_asmdata.RefAsmSymbol(externalname,AT_DATA),0,sizeof(aint));
       { Always do indirect jump using $t9, it won't harm in non-PIC mode }
       if (cs_create_pic in current_settings.moduleswitches) then
         begin
@@ -258,11 +258,11 @@ implementation
       list.concat(taicpu.op_reg(A_JR, NR_PIC_FUNC));
     end
     else if not (cs_create_pic in current_settings.moduleswitches) then
-      list.concat(taicpu.op_sym(A_J,current_asmdata.RefAsmSymbol(procdef.mangledname)))
+      list.concat(taicpu.op_sym(A_J,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)))
     else
       begin
         { GAS does not expand "J symbol" into PIC sequence }
-        reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0,sizeof(pint));
+        reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION),0,sizeof(pint));
         href.base:=NR_GP;
         href.refaddr:=addr_pic_call16;
         list.concat(taicpu.op_reg_ref(A_LW,NR_PIC_FUNC,href));

+ 2 - 2
compiler/mips/racpugas.pas

@@ -178,7 +178,7 @@ Interface
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);
@@ -267,7 +267,7 @@ Interface
                 Consume(AS_LPAREN);
                 BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
                 if not assigned(oper.opr.ref.symbol) then
-                  oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
+                  oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp)
                 else
                   Message(asmr_e_cant_have_multiple_relocatable_symbols);
                 case oper.opr.typ of

+ 1 - 1
compiler/ncgld.pas

@@ -301,7 +301,7 @@ implementation
              paraloc1.init;
              paramanager.getintparaloc(current_asmdata.CurrAsmList,tprocvardef(pvd),1,paraloc1);
              hregister:=hlcg.getaddressregister(current_asmdata.CurrAsmList,pvd);
-             reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE'),0,pvd.size);
+             reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,pvd.size);
              hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,pvd,pvd,href,hregister);
              hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,pvd,OC_EQ,0,hregister,norelocatelab);
              { no, call it with the index of the threadvar as parameter }

+ 1 - 1
compiler/ncgmem.pas

@@ -539,7 +539,7 @@ implementation
                classes can be changed without breaking programs compiled against
                earlier versions)
              }
-             asmsym:=current_asmdata.RefAsmSymbol(vs.mangledname);
+             asmsym:=current_asmdata.RefAsmSymbol(vs.mangledname,AT_DATA);
              reference_reset_symbol(tmpref,asmsym,0,sizeof(pint));
              hlcg.g_ptrtypecast_ref(current_asmdata.CurrAsmList,left.resultdef,cpointerdef.getreusable(resultdef),location.reference);
              location.reference.index:=hlcg.getintregister(current_asmdata.CurrAsmList,ptruinttype);

+ 8 - 8
compiler/objcgutl.pas

@@ -243,7 +243,7 @@ procedure objcfinishclassrefnfpoolentry(entry: phashsetitem; classdef: tobjectde
         entry^.Data:=reflab;
 
         { add a pointer to the class }
-        classym:=current_asmdata.RefAsmSymbol(classdef.rtti_mangledname(objcclassrtti));
+        classym:=current_asmdata.RefAsmSymbol(classdef.rtti_mangledname(objcclassrtti),AT_DATA);
 
         tcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_new_section]);
         tcb.emit_tai(Tai_const.Create_sym(classym),voidpointertype);
@@ -1415,7 +1415,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_category_sections(list:TAsmList; o
     objcreatestringpoolentry(objccat.objextname^,sp_objcclassnames,sec_objc_class_names,catstrsym,catstrdef);
 
     { the class it extends }
-    clssym:=current_asmdata.RefAsmSymbol(objccat.childof.rtti_mangledname(objcclassrtti));
+    clssym:=current_asmdata.RefAsmSymbol(objccat.childof.rtti_mangledname(objcclassrtti),AT_DATA);
 
     { generate the methods lists }
     gen_objc_methods(list,objccat,instmthdlist,false,true);
@@ -1724,8 +1724,8 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
     { 2) the superclass and meta superclass }
     if assigned(objclss.childof) then
       begin
-        superSym:=current_asmdata.RefAsmSymbol(objclss.childof.rtti_mangledname(objcclassrtti));
-        superMetaSym:=current_asmdata.RefAsmSymbol(objclss.childof.rtti_mangledname(objcmetartti));
+        superSym:=current_asmdata.RefAsmSymbol(objclss.childof.rtti_mangledname(objcclassrtti),AT_DATA);
+        superMetaSym:=current_asmdata.RefAsmSymbol(objclss.childof.rtti_mangledname(objcmetartti),AT_DATA);
       end
     else
       begin
@@ -1739,7 +1739,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
     root:=objclss;
     while assigned(root.childof) do
       root:=root.childof;
-    metaisaSym:=current_asmdata.RefAsmSymbol(root.rtti_mangledname(objcmetartti));
+    metaisaSym:=current_asmdata.RefAsmSymbol(root.rtti_mangledname(objcmetartti),AT_DATA);
 
     { 4) the implemented protocols (same for metaclass and regular class) }
     gen_objc_protocol_list(list,objclss.ImplementedInterfaces,protolistsym);
@@ -1759,12 +1759,12 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
     metatcb.emit_tai(Tai_const.Create_sym(superMetaSym),voidpointertype);
     { pointer to cache }
     if not assigned(ObjCEmptyCacheVar) then
-      ObjCEmptyCacheVar:=current_asmdata.RefAsmSymbol(target_info.Cprefix+'_objc_empty_cache');
+      ObjCEmptyCacheVar:=current_asmdata.RefAsmSymbol(target_info.Cprefix+'_objc_empty_cache',AT_DATA);
     metatcb.emit_tai(Tai_const.Create_sym(ObjCEmptyCacheVar),voidpointertype);
     { pointer to vtable }
     if not assigned(ObjCEmptyVtableVar) and
        not(target_info.system in [system_arm_darwin,system_aarch64_darwin,system_i386_iphonesim,system_x86_64_iphonesim]) then
-      ObjCEmptyVtableVar:=current_asmdata.RefAsmSymbol(target_info.Cprefix+'_objc_empty_vtable');
+      ObjCEmptyVtableVar:=current_asmdata.RefAsmSymbol(target_info.Cprefix+'_objc_empty_vtable',AT_DATA);
     ConcatSymOrNil(metatcb,ObjCEmptyVtableVar,voidpointertype);
     { the read-only part }
     metatcb.emit_tai(Tai_const.Create_sym(metarosym),voidpointertype);
@@ -1817,7 +1817,7 @@ procedure tobjcrttiwriter_nonfragile.addclasslist(list: tasmlist; section: tasms
     tcb.maybe_begin_aggregate(arrdef);
     for i:=0 to classes.count-1 do
       tcb.emit_tai(
-        tai_const.Create_sym(current_asmdata.RefAsmSymbol(tobjectdef(classes[i]).rtti_mangledname(objcclassrtti))),
+        tai_const.Create_sym(current_asmdata.RefAsmSymbol(tobjectdef(classes[i]).rtti_mangledname(objcclassrtti),AT_DATA)),
         voidpointertype
       );
     tcb.maybe_end_aggregate(arrdef);

+ 2 - 2
compiler/powerpc/cgcpu.pas

@@ -668,7 +668,7 @@ const
          if (target_info.system = system_powerpc_darwin) then
            p := taicpu.op_sym(A_B,get_darwin_call_stub(s,false))
         else
-          p := taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s));
+          p := taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
         p.is_jmp := true;
         list.concat(p)
       end;
@@ -997,7 +997,7 @@ const
              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
-               a_call_name(current_asmdata.RefAsmSymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_x'))
+               a_call_name(current_asmdata.RefAsmSymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_x',AT_FUNCTION))
              else
                { leaf node => lr haven't to be restored }
                a_call_name('_restfpr_'+tostr(ord(firstregfpu.enum)-ord(R_F14)+14)+'_l');

+ 1 - 1
compiler/powerpc/nppccal.pas

@@ -97,7 +97,7 @@ implementation
                   cg.getcpuregister(current_asmdata.CurrAsmList,NR_R12);
 
                   reference_reset(tmpref,sizeof(pint));
-                  tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname);
+                  tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname,AT_DATA);
                   tmpref.refaddr:=addr_higha;
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R12,tmpref));
                   tmpref.base:=NR_R12;

+ 1 - 1
compiler/powerpc/rappcgas.pas

@@ -232,7 +232,7 @@ Unit rappcgas;
                     if (relsym<>'') then
                       begin
                         if (oper.opr.typ = OPR_REFERENCE) then
-                          oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
+                          oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym,asmsymtyp)
                         else
                           begin
                             Message(asmr_e_invalid_reference_syntax);

+ 3 - 3
compiler/powerpc64/cgcpu.pas

@@ -293,9 +293,9 @@ begin
   if (prependDot) then
     s := '.' + s;
   if not(weak) then
-    list.concat(taicpu.op_sym(opc, current_asmdata.RefAsmSymbol(s)))
+    list.concat(taicpu.op_sym(opc, current_asmdata.RefAsmSymbol(s,AT_FUNCTION)))
   else
-    list.concat(taicpu.op_sym(opc, current_asmdata.WeakRefAsmSymbol(s)));
+    list.concat(taicpu.op_sym(opc, current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)));
   if (addNOP) then
     list.concat(taicpu.op_none(A_NOP));
 
@@ -965,7 +965,7 @@ var
 begin
   if (prependDot) then
     s := '.' + s;
-  p := taicpu.op_sym(opc, current_asmdata.RefAsmSymbol(s));
+  p := taicpu.op_sym(opc, current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
   p.is_jmp := true;
   list.concat(p)
 end;

+ 1 - 1
compiler/powerpc64/rappcgas.pas

@@ -245,7 +245,7 @@ begin
               if (relsym<>'') then
                 begin
                   if (oper.opr.typ = OPR_REFERENCE) then
-                    oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
+                    oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym,asmsymtyp)
                   else
                     begin
                       Message(asmr_e_invalid_reference_syntax);

+ 8 - 8
compiler/ppcgen/cgppc.pas

@@ -346,7 +346,7 @@ unit cgppc;
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         { register as a weak symbol if necessary }
         if weak then
-          current_asmdata.weakrefasmsymbol(s);
+          current_asmdata.weakrefasmsymbol(s,AT_FUNCTION);
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         l1 := current_asmdata.DefineAsmSymbol('L'+s+'$lazy_ptr',AB_LOCAL,AT_DATA,voidpointertype);
         reference_reset_symbol(href,l1,0,sizeof(pint));
@@ -823,11 +823,11 @@ unit cgppc;
                 to define the symbol that's being accessed as either weak or
                 not }
               if not(is_weak in flags) then
-                current_asmdata.RefAsmSymbol(symname)
+                current_asmdata.RefAsmSymbol(symname,AT_DATA)
               else if is_data in flags then
-                current_asmdata.WeakRefAsmSymbol(symname)
+                current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
               else
-                current_asmdata.WeakRefAsmSymbol('.'+symname);
+                current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
               newsymname:=ReplaceForbiddenAsmSymbolChars(symname);
               current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_toc_entry,newsymname+'[TC],'+newsymname));
             end;
@@ -852,17 +852,17 @@ unit cgppc;
                 end;
               { add the reference to the actual symbol inside the tocsubtable }
               if not(is_weak in flags) then
-                current_asmdata.RefAsmSymbol(symname)
+                current_asmdata.RefAsmSymbol(symname,AT_DATA)
               else if is_data in flags then
-                current_asmdata.WeakRefAsmSymbol(symname)
+                current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
               else
-                current_asmdata.WeakRefAsmSymbol('.'+symname);
+                current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
               tocsym:=TTOCAsmSymbol(current_asmdata.DefineAsmSymbolByClass(TTOCAsmSymbol,nlsymname,AB_LOCAL,AT_DATA,voidpointertype));
               ref.symbol:=tocsym;
               tocsym.ftocsecnr:=tocnr;
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(tocsym,0));
               newsymname:=ReplaceForbiddenAsmSymbolChars(symname);
-              sym:=current_asmdata.RefAsmSymbol(newsymname);
+              sym:=current_asmdata.RefAsmSymbol(newsymname,AT_DATA);
               current_asmdata.asmlists[al_indirectpicdata].concat(tai_const.Create_sym(sym));
             end;
           { first load the address of the table from the TOC }

+ 2 - 2
compiler/ppcgen/hlcgppc.pas

@@ -185,9 +185,9 @@ implementation
             list.concat(taicpu.op_sym(A_B,tcgppcgen(cg).get_darwin_call_stub(procdef.mangledname,false)));
           else if use_dotted_functions then
             {$note ts:todo add GOT change?? - think not needed :) }
-            list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)))
+            list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname,AT_FUNCTION)))
           else
-            list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)))
+            list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)))
         end;
       List.concat(Tai_symbol_end.Createname(labelname));
     end;

+ 2 - 2
compiler/raatt.pas

@@ -1708,7 +1708,7 @@ unit raatt;
          begin
            oper.opr.typ:=OPR_SYMBOL;
            oper.opr.symofs:=l;
-           oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr);
+           oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp);
          end
         else
          begin
@@ -1735,7 +1735,7 @@ unit raatt;
                 BuildConstSymbolExpression(false,false,false,value,asmsym,asmsymtyp);
                 if asmsym<>'' then
                  begin
-                   ai:=tai_const.create_type_sym(aitconst_rva_symbol,current_asmdata.RefAsmSymbol(asmsym));
+                   ai:=tai_const.create_type_sym(aitconst_rva_symbol,current_asmdata.RefAsmSymbol(asmsym,asmsymtyp));
                    ai.value:=value;
                    curlist.concat(ai);
                  end

+ 4 - 4
compiler/rautils.pas

@@ -849,7 +849,7 @@ Begin
           staticvarsym :
             begin
               initref;
-              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(sym).mangledname);
+              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(sym).mangledname,AT_DATA);
             end;
           paravarsym,
           localvarsym :
@@ -914,7 +914,7 @@ Begin
         case opr.typ of
           OPR_REFERENCE:
             begin
-              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname);
+              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname,AT_FUNCTION);
 {$ifdef i8086}
               opr.ref_farproc_entry:=is_proc_far(tprocdef(tprocsym(sym).ProcdefList[0]))
                         and not (po_interrupt in tprocdef(tprocsym(sym).ProcdefList[0]).procoptions);
@@ -923,7 +923,7 @@ Begin
           OPR_NONE:
             begin
               opr.typ:=OPR_SYMBOL;
-              opr.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname);
+              opr.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname,AT_FUNCTION);
 {$ifdef i8086}
               opr.sym_farproc_entry:=is_proc_far(tprocdef(tprocsym(sym).ProcdefList[0]))
                         and not (po_interrupt in tprocdef(tprocsym(sym).ProcdefList[0]).procoptions);
@@ -943,7 +943,7 @@ Begin
         case opr.typ of
           OPR_REFERENCE:
             begin
-              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tlabelsym(sym).mangledname);
+              opr.ref.symbol:=current_asmdata.RefAsmSymbol(tlabelsym(sym).mangledname,AT_FUNCTION);
               if opr.ref.segment=NR_NO then
                 opr.ref.segment:=NR_CS;
             end;

+ 5 - 5
compiler/sparc/cgcpu.pas

@@ -378,9 +378,9 @@ implementation
     procedure TCgSparc.a_call_name(list:TAsmList;const s:string; weak: boolean);
       begin
         if not weak then
-          list.concat(taicpu.op_sym(A_CALL,current_asmdata.RefAsmSymbol(s)))
+          list.concat(taicpu.op_sym(A_CALL,current_asmdata.RefAsmSymbol(s,AT_FUNCTION)))
         else
-          list.concat(taicpu.op_sym(A_CALL,current_asmdata.WeakRefAsmSymbol(s)));
+          list.concat(taicpu.op_sym(A_CALL,current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION)));
         { Delay slot }
         list.concat(taicpu.op_none(A_NOP));
       end;
@@ -876,7 +876,7 @@ implementation
 
     procedure TCgSparc.a_jmp_always(List:TAsmList;l:TAsmLabel);
       begin
-        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(l.name)));
+        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(l.name,AT_FUNCTION)));
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
       end;
@@ -884,7 +884,7 @@ implementation
 
     procedure tcgsparc.a_jmp_name(list : TAsmList;const s : string);
       begin
-        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(s)));
+        List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(s,AT_FUNCTION)));
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
       end;
@@ -1022,7 +1022,7 @@ implementation
                  sethi  %hi(_GLOBAL_OFFSET_TABLE_+(.-1b)), %l7
             2:   or     %l7, %lo(_GLOBAL_OFFSET_TABLE_+(.-1b)), %l7
                  add    %l7, %o7, %l7 }
-            reference_reset_symbol(ref,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),4,sizeof(pint));
+            reference_reset_symbol(ref,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_',AT_DATA),4,sizeof(pint));
             ref.refaddr:=addr_high;
             list.concat(taicpu.op_ref_reg(A_SETHI,ref,NR_L7));
             cg.a_label(list,hl);

+ 1 - 1
compiler/sparc/hlcgcpu.pas

@@ -128,7 +128,7 @@ implementation
     begin
       { CALL overwrites %o7 with its own address, we use delay slot to restore it. }
       list.concat(taicpu.op_reg_reg(A_MOV,NR_O7,NR_G1));
-      list.concat(taicpu.op_sym(A_CALL,current_asmdata.RefAsmSymbol(externalname)));
+      list.concat(taicpu.op_sym(A_CALL,current_asmdata.RefAsmSymbol(externalname,AT_FUNCTION)));
       list.concat(taicpu.op_reg_reg(A_MOV,NR_G1,NR_O7));
     end;
 

+ 2 - 2
compiler/sparc/racpugas.pas

@@ -231,7 +231,7 @@ Interface
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);
@@ -306,7 +306,7 @@ Interface
                 Consume(AS_LPAREN);
                 BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
                 if not assigned(oper.opr.ref.symbol) then
-                  oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
+                  oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp)
                 else
                   Message(asmr_e_cant_have_multiple_relocatable_symbols);
                 case oper.opr.typ of

+ 1 - 1
compiler/systems/t_beos.pas

@@ -152,7 +152,7 @@ begin
            { place jump in al_procedures }
            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,pd));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
          end;

+ 1 - 1
compiler/systems/t_haiku.pas

@@ -153,7 +153,7 @@ begin
            { place jump in al_procedures }
            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,pd));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
          end;

+ 1 - 1
compiler/systems/t_nwl.pas

@@ -230,7 +230,7 @@ begin
            { place jump in al_procedures }
            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,pd));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
          end;

+ 1 - 1
compiler/systems/t_nwm.pas

@@ -232,7 +232,7 @@ begin
            { place jump in al_procedures }
            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,pd));
-           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
+           current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname,AT_FUNCTION)));
            current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
          end;

+ 3 - 3
compiler/systems/t_win.pas

@@ -878,14 +878,14 @@ implementation
               if assigned(hp.sym) and not (eo_no_sym_name in hp.options) then
                 case hp.sym.typ of
                   staticvarsym :
-                    asmsym:=current_asmdata.RefAsmSymbol(tstaticvarsym(hp.sym).mangledname);
+                    asmsym:=current_asmdata.RefAsmSymbol(tstaticvarsym(hp.sym).mangledname,AT_DATA);
                   procsym :
-                    asmsym:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(hp.sym).ProcdefList[0]).mangledname)
+                    asmsym:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(hp.sym).ProcdefList[0]).mangledname,AT_FUNCTION)
                   else
                     internalerror(200709272);
                 end
               else
-                asmsym:=current_asmdata.RefAsmSymbol(hp.name^);
+                asmsym:=current_asmdata.RefAsmSymbol(hp.name^,AT_DATA);
               address_table.concat(Tai_const.Create_rva_sym(asmsym));
               inc(current_index);
               hp:=texported_item(hp.next);

+ 6 - 6
compiler/x86/cgx86.pas

@@ -790,7 +790,7 @@ unit cgx86;
         r: treference;
       begin
         if (target_info.system <> system_i386_darwin) then
-          list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s)))
+          list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s,AT_FUNCTION)))
         else
           begin
             reference_reset_symbol(r,get_darwin_call_stub(s,false),0,sizeof(pint));
@@ -823,7 +823,7 @@ unit cgx86;
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         { register as a weak symbol if necessary }
         if weak then
-          current_asmdata.weakrefasmsymbol(s);
+          current_asmdata.weakrefasmsymbol(s,AT_FUNCTION);
         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));
@@ -848,9 +848,9 @@ unit cgx86;
         if (target_info.system <> system_i386_darwin) then
           begin
             if not(weak) then
-              sym:=current_asmdata.RefAsmSymbol(s)
+              sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION)
             else
-              sym:=current_asmdata.WeakRefAsmSymbol(s);
+              sym:=current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION);
             reference_reset_symbol(r,sym,0,sizeof(pint));
             if (cs_create_pic in current_settings.moduleswitches) and
                { darwin's assembler doesn't want @PLT after call symbols }
@@ -884,7 +884,7 @@ unit cgx86;
         sym : tasmsymbol;
         r : treference;
       begin
-        sym:=current_asmdata.RefAsmSymbol(s);
+        sym:=current_asmdata.RefAsmSymbol(s,AT_FUNCTION);
         reference_reset_symbol(r,sym,0,sizeof(pint));
         r.refaddr:=addr_full;
         list.concat(taicpu.op_ref(A_CALL,S_NO,r));
@@ -1147,7 +1147,7 @@ unit cgx86;
                       system_i386_linux,system_i386_android:
                         if segment=NR_GS then
                           begin
-                            reference_reset_symbol(tmpref,current_asmdata.RefAsmSymbol('___fpc_threadvar_offset'),0,dirref.alignment);
+                            reference_reset_symbol(tmpref,current_asmdata.RefAsmSymbol('___fpc_threadvar_offset',AT_DATA),0,dirref.alignment);
                             tmpref.segment:=NR_GS;
                             list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r));
                           end

+ 1 - 1
compiler/x86/hlcgx86.pas

@@ -76,7 +76,7 @@ implementation
          exit;
        end;
 
-      sym:=current_asmdata.RefAsmSymbol(externalname);
+      sym:=current_asmdata.RefAsmSymbol(externalname,AT_FUNCTION);
       reference_reset_symbol(ref,sym,0,sizeof(pint));
 
       { create pic'ed? }

+ 2 - 2
compiler/x86/nx86inl.pas

@@ -341,7 +341,7 @@ implementation
              case tfloatdef(resultdef).floattype of
                s32real:
                  begin
-                   reference_reset_symbol(href,current_asmdata.RefAsmSymbol(target_info.cprefix+'FPC_ABSMASK_SINGLE'),0,4);
+                   reference_reset_symbol(href,current_asmdata.RefAsmSymbol(target_info.cprefix+'FPC_ABSMASK_SINGLE',AT_DATA),0,4);
                    tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList, href);
                    if UseAVX then
                      current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg_reg(
@@ -351,7 +351,7 @@ implementation
                  end;
                s64real:
                  begin
-                   reference_reset_symbol(href,current_asmdata.RefAsmSymbol(target_info.cprefix+'FPC_ABSMASK_DOUBLE'),0,4);
+                   reference_reset_symbol(href,current_asmdata.RefAsmSymbol(target_info.cprefix+'FPC_ABSMASK_DOUBLE',AT_DATA),0,4);
                    tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList, href);
                    if UseAVX then
                      current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg_reg(

+ 1 - 1
compiler/x86/rax86.pas

@@ -299,7 +299,7 @@ begin
 {$ifdef i8086}
   opr.typ:=OPR_SYMBOL;
   opr.symofs:=0;
-  opr.symbol:=current_asmdata.RefAsmSymbol(current_procinfo.procdef.mangledname);
+  opr.symbol:=current_asmdata.RefAsmSymbol(current_procinfo.procdef.mangledname,AT_FUNCTION);
   opr.symseg:=true;
   opr.sym_farproc_entry:=false;
 {$else i8086}

+ 2 - 2
compiler/x86/rax86att.pas

@@ -387,7 +387,7 @@ Implementation
               BuildConstSymbolExpression(true,true,false,l,relsym,asmsymtyp);
               if (relsym<>'') then
                 if not assigned(oper.opr.ref.relsymbol) then
-                  oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
+                  oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym,asmsymtyp)
                 else
                   Message(asmr_e_invalid_reference_syntax)
               else
@@ -471,7 +471,7 @@ Implementation
                     if (oper.opr.val<>0) then
                       Message(asmr_e_wrong_sym_type);
                     oper.opr.typ:=OPR_SYMBOL;
-                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname);
+                    oper.opr.symbol:=current_asmdata.RefAsmSymbol(mangledname,AT_FUNCTION);
                   end
                 else
                   inc(oper.opr.val,l);

+ 3 - 3
compiler/x86/rax86int.pas

@@ -1553,7 +1553,7 @@ Unit Rax86int;
                     Message(asmr_e_only_add_relocatable_symbol);
                    if not assigned(oper.opr.ref.symbol) then
                      begin
-                       oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr);
+                       oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp);
 {$ifdef i8086}
                        if isseg then
                          begin
@@ -1656,7 +1656,7 @@ Unit Rax86int;
           begin
             oper.opr.typ:=OPR_SYMBOL;
             oper.opr.symofs:=l;
-            oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr);
+            oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr,tempsymtyp);
             oper.opr.symseg:=isseg;
             oper.opr.sym_farproc_entry:=is_farproc_entry;
           end
@@ -1741,7 +1741,7 @@ Unit Rax86int;
                         if (hs <> '') then
                           begin
                             oper.opr.typ:=OPR_SYMBOL;
-                            oper.opr.symbol:=current_asmdata.RefAsmSymbol(hs);
+                            oper.opr.symbol:=current_asmdata.RefAsmSymbol(hs,AT_FUNCTION);
                           end
                         else
                           begin

+ 1 - 1
compiler/x86_64/hlcgcpu.pas

@@ -97,7 +97,7 @@ implementation
         end
       else
         begin
-          sym:=current_asmdata.RefAsmSymbol(procdef.mangledname);
+          sym:=current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION);
           reference_reset_symbol(r,sym,0,sizeof(pint));
           if (cs_create_pic in current_settings.moduleswitches) and
              { darwin/x86_64's assembler doesn't want @PLT after call symbols }

+ 2 - 2
compiler/x86_64/nx64cal.pas

@@ -47,7 +47,7 @@ implementation
       systems,verbose,cutils,
       cpubase,cgbase,cgutils,cgobj,
       symsym,symcpu,nld,
-      aasmtai,aasmdata,aasmcpu;
+      aasmbase,aasmtai,aasmdata,aasmcpu;
 
 {    uses
       globtype,systems,
@@ -70,7 +70,7 @@ implementation
               // one syscall convention for AROS
               current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('AROS SysCall')));
               reference_reset(tmpref,sizeof(pint));
-              tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname);
+              tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname,AT_FUNCTION);
               cg.getcpuregister(current_asmdata.CurrAsmList,NR_RAX);
               cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_RAX);
               reference_reset_base(tmpref,NR_RAX,-tprocdef(procdefinition).extnumber,sizeof(pint));

+ 1 - 1
compiler/x86_64/nx64flw.pas

@@ -345,7 +345,7 @@ procedure tx64tryfinallynode.pass_generate_code;
 
     { generate the scope record in .xdata }
     tx86_64procinfo(current_procinfo).add_finally_scope(trylabel,endtrylabel,
-      current_asmdata.RefAsmSymbol(finalizepi.procdef.mangledname),catch_frame);
+      current_asmdata.RefAsmSymbol(finalizepi.procdef.mangledname,AT_FUNCTION),catch_frame);
 
     if implicitframe then
       current_procinfo.CurrExitLabel:=oldexitlabel;