diff --git a/compiler/aasmdata.pas b/compiler/aasmdata.pas index e53bdee033..2b2a03d8c3 100644 --- a/compiler/aasmdata.pas +++ b/compiler/aasmdata.pas @@ -128,9 +128,9 @@ interface constructor create(const n:string); destructor destroy;override; { 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 newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel; { create new assembler label } procedure getlabel(var l : tasmlabel;alt:tasmlabeltype); procedure getjumplabel(var l : tasmlabel); @@ -315,25 +315,23 @@ implementation end; - function TAsmData.newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol; + function TAsmData.DefineAsmSymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol; var hp : tasmsymbol; begin hp:=tasmsymbol(FAsmSymbolDict.search(s)); if assigned(hp) then 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 - //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; - {$ENDIF} - if (_bind<>AB_EXTERNAL) then - hp.bind:=_bind + hp.typ:=_typ; + hp.bind:=_bind; end else begin @@ -341,7 +339,22 @@ implementation hp:=tasmsymbol.create(s,_bind,_typ); FAsmSymbolDict.insert(hp); 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; @@ -372,19 +385,6 @@ implementation 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); begin l:=tasmlabel.createlocal(FNextLabelNr[alt],alt); diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index 5e5c9cf6b0..3a9c16a114 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -398,7 +398,7 @@ interface constructor Create_rel_sym(_typ:taiconst_type;_sym,_endsym:tasmsymbol); constructor Create_rva_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 ppuload(t:taitype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -856,7 +856,7 @@ implementation begin inherited Create; typ:=ait_datablock; - sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,AT_DATA); + sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA); { keep things aligned } if _size<=0 then _size:=4; @@ -869,7 +869,7 @@ implementation begin inherited Create; typ:=ait_datablock; - sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_DATA); + sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA); { keep things aligned } if _size<=0 then _size:=4; @@ -931,7 +931,7 @@ implementation begin inherited Create; typ:=ait_symbol; - sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,_symtyp); + sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_symtyp); size:=siz; is_global:=false; end; @@ -941,7 +941,7 @@ implementation begin inherited Create; typ:=ait_symbol; - sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,_symtyp); + sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_symtyp); size:=siz; is_global:=true; end; @@ -986,7 +986,7 @@ implementation begin inherited Create; typ:=ait_symbol_end; - sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_NONE); + sym:=current_asmdata.RefAsmSymbol(_name); end; @@ -1231,12 +1231,12 @@ implementation end; - constructor tai_const.Createname(const name:string;_symtyp:Tasmsymtype;ofs:aint); + constructor tai_const.Createname(const name:string;ofs:aint); begin inherited Create; typ:=ait_const; consttype:=aitconst_ptr; - sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,_symtyp); + sym:=current_asmdata.RefAsmSymbol(name); endsym:=nil; value:=ofs; { update sym info } @@ -1249,7 +1249,7 @@ implementation inherited Create; typ:=ait_const; consttype:=aitconst_rva_symbol; - sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.RefAsmSymbol(name); endsym:=nil; value:=0; { update sym info } diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index b6c4632bb3..7f7b39e96c 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -270,7 +270,7 @@ unit cgcpu; procedure tcgarm.a_call_name(list : TAsmList;const s : string); 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 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); 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; @@ -1478,7 +1478,7 @@ unit cgcpu; end { case 0 } 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)); end; diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index 21aa4d7961..384135e71b 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -1873,7 +1873,7 @@ implementation paramanager.getintparaloc(pocall_default,2,cgpara2); if (cs_check_object in aktlocalswitches) then 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); a_paramaddr_ref(list,hrefvmt,cgpara2); paramanager.allocparaloc(list,cgpara1); @@ -2115,9 +2115,9 @@ implementation l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr'); if not(assigned(l)) then 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_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)); end; result := cg.getaddressregister(list); diff --git a/compiler/cresstr.pas b/compiler/cresstr.pas index e3a381d452..57ca43df48 100644 --- a/compiler/cresstr.pas +++ b/compiler/cresstr.pas @@ -189,7 +189,7 @@ uses } current_asmdata.asmlists[al_resourcestrings].concat(Tai_cutobject.Create); 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_const.create_sym(namelab)); current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil)); diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index eebb8deed2..c417e349ac 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -1450,7 +1450,7 @@ implementation current_asmdata.getlabel(procendlabel,alt_dbgtype); 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); { @@ -1551,7 +1551,7 @@ implementation else begin 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); end; end; @@ -1707,7 +1707,7 @@ implementation toasm : begin 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); end; tovar: @@ -1774,7 +1774,7 @@ implementation ]); { append block data } 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)); finish_entry; @@ -1920,10 +1920,10 @@ implementation { abbrev table } if isdwarf64 then 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 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 } 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]); { 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; diff --git a/compiler/dbgstabs.pas b/compiler/dbgstabs.pas index 2053ecad9f..5fee2808e8 100644 --- a/compiler/dbgstabs.pas +++ b/compiler/dbgstabs.pas @@ -1495,11 +1495,11 @@ implementation while assigned(hp) do begin 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); end; { 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; diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index 11a21f485a..909526e311 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -641,7 +641,7 @@ unit cgcpu; { case 0 } else 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)); end; diff --git a/compiler/i386/ra386int.pas b/compiler/i386/ra386int.pas index aaaf521b78..f70e7228a0 100644 --- a/compiler/i386/ra386int.pas +++ b/compiler/i386/ra386int.pas @@ -1395,7 +1395,7 @@ Unit Ra386int; if GotStar then Message(asmr_e_only_add_relocatable_symbol); 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 Message(asmr_e_cant_have_multiple_relocatable_symbols); end; @@ -1478,7 +1478,7 @@ Unit Ra386int; begin oper.opr.typ:=OPR_SYMBOL; oper.opr.symofs:=l; - oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); + oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr); end else if oper.opr.typ=OPR_NONE then diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas index 34c8e08982..4158476266 100644 --- a/compiler/m68k/cgcpu.pas +++ b/compiler/m68k/cgcpu.pas @@ -247,7 +247,7 @@ unit cgcpu; procedure tcg68k.a_call_name(list : TAsmList;const s : string); 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; @@ -1261,7 +1261,7 @@ unit cgcpu; end { case 0 } 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)); end; diff --git a/compiler/m68k/ra68kmot.pas b/compiler/m68k/ra68kmot.pas index b43e9bb954..5bea23aabf 100644 --- a/compiler/m68k/ra68kmot.pas +++ b/compiler/m68k/ra68kmot.pas @@ -1311,7 +1311,7 @@ const l:=oper.opr.val; oper.opr.typ := OPR_SYMBOL; oper.opr.symofs := l; - oper.opr.symbol := current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION); + oper.opr.symbol := current_asmdata.RefAsmSymbol(tempstr); end; end; { // Constant memory offset . // } diff --git a/compiler/ncgcnv.pas b/compiler/ncgcnv.pas index b3e353c81e..b3ad8a56a0 100644 --- a/compiler/ncgcnv.pas +++ b/compiler/ncgcnv.pas @@ -155,7 +155,7 @@ interface if tstringconstnode(left).len=0 then begin 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); cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register); end @@ -175,7 +175,7 @@ interface if tstringconstnode(left).len=0 then begin 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); cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register); end @@ -430,7 +430,7 @@ interface end; cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,location.register,l1); 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_label(current_asmdata.CurrAsmList,l1); end; diff --git a/compiler/ncgflw.pas b/compiler/ncgflw.pas index 8978c92db8..a85a44272e 100644 --- a/compiler/ncgflw.pas +++ b/compiler/ncgflw.pas @@ -1242,7 +1242,7 @@ implementation current_asmdata.getjumplabel(nextonlabel); { 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.allocparaloc(current_asmdata.CurrAsmList,paraloc1); cg.a_paramaddr_ref(current_asmdata.CurrAsmList,href2,paraloc1); diff --git a/compiler/ncginl.pas b/compiler/ncginl.pas index e057e5d4d1..597077f95f 100644 --- a/compiler/ncginl.pas +++ b/compiler/ncginl.pas @@ -266,7 +266,7 @@ implementation if left.nodetype=typen then begin 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); end else diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index 395569f7a3..671127cacb 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -72,7 +72,7 @@ implementation begin {$ifndef sparc} 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} end; @@ -105,7 +105,7 @@ implementation location.reference.offset:=tabsolutevarsym(symtableentry).addroffset; end; toasm : - location.reference.symbol:=current_asmdata.newasmsymbol(tabsolutevarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.RefAsmSymbol(tabsolutevarsym(symtableentry).mangledname); else internalerror(200310283); end; @@ -115,7 +115,7 @@ implementation if tconstsym(symtableentry).consttyp=constresourcestring then begin 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: TResourceStringRecord = Packed Record Name, @@ -147,7 +147,7 @@ implementation { DLL variable } begin 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); reference_reset_base(location.reference,hregister,0); end @@ -171,11 +171,11 @@ implementation paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); 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_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 } - 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); cg.a_param_ref(current_asmdata.CurrAsmList,OS_32,href,paraloc1); paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); @@ -193,7 +193,7 @@ implementation layout of a threadvar is (4 bytes pointer): 0 - Threadvar index 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_label(current_asmdata.CurrAsmList,endrelocatelab); location.reference.base:=hregister; @@ -246,7 +246,7 @@ implementation staticsymtable : begin 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 location:=tglobalvarsym(symtableentry).localloc; {$ifdef i386} @@ -360,7 +360,7 @@ implementation else begin { 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); 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); @@ -372,11 +372,11 @@ implementation location.reference.base := cg.g_indirect_sym_load(current_asmdata.CurrAsmList,tprocsym(symtableentry).procdef[1].mangledname); {!!!!! Be aware, work on virtual methods too } 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; typedconstsym : - location.reference.symbol:=current_asmdata.newasmsymbol(ttypedconstsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.RefAsmSymbol(ttypedconstsym(symtableentry).mangledname); labelsym : location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel; else internalerror(200510032); diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index 2f5e2b8f73..c10f8651c7 100644 --- a/compiler/ncgmem.pas +++ b/compiler/ncgmem.pas @@ -101,7 +101,7 @@ implementation if (left.nodetype=typen) then begin 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); cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register); end @@ -312,7 +312,7 @@ implementation LOC_REFERENCE, LOC_CREFERENCE: ; -{ record regvars are not supported yet +{ record regvars are not supported yet LOC_CREGISTER: } else internalerror(2006031901); @@ -697,7 +697,7 @@ implementation current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); - + { if mulsize = 1, we won't have to modify the index } location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,(mulsize = 1)); diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index a386029ba5..b19f0b3779 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -1737,11 +1737,7 @@ implementation item := tstringlistitem(pd.aliasnames.first); while assigned(item) do 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); end; end; @@ -1786,7 +1782,7 @@ implementation else list.concat(tai_directive.create(asd_mod_term_func,'')); 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; if (current_procinfo.procdef.proctypeoption=potype_proginit) then @@ -1940,7 +1936,7 @@ implementation begin current_module.requires_ebx_pic_helper:=true; 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)); { ecx could be used in leave procedures } current_procinfo.got:=NR_EBX; @@ -2110,7 +2106,7 @@ implementation { 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 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; else internalerror(200410103); diff --git a/compiler/nobj.pas b/compiler/nobj.pas index 441b59062a..b82ef8f368 100644 --- a/compiler/nobj.pas +++ b/compiler/nobj.pas @@ -280,7 +280,7 @@ implementation { write name label } 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 writestrentry(p^.r); @@ -322,7 +322,7 @@ implementation { 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.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 writeintentry(p^.r); @@ -398,7 +398,7 @@ implementation begin if assigned(p^.l) then 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 writedmtaddressentry(p^.r); end; @@ -484,7 +484,7 @@ implementation if po_abstractmethod in pd.procoptions then current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)) 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; @@ -884,7 +884,7 @@ implementation tostr(i)+'_$_'+ implintf.implprocs(intfindex,i).mangledname); { create reference } - rawdata.concat(Tai_const.Createname(tmps,AT_FUNCTION,0)); + rawdata.concat(Tai_const.Createname(tmps,0)); end; section_symbol_end(rawdata,gintfgetvtbllabelname(intfindex)); end; @@ -919,7 +919,7 @@ implementation current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); end; { 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 } current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(implintf.ioffsets(contintfindex))); { IIDStr } @@ -1232,9 +1232,9 @@ implementation { class abstract and it's not allow to } { generates an instance } 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 - List.concat(Tai_const.createname(procdefcoll^.data.mangledname,AT_FUNCTION,0)); + List.concat(Tai_const.createname(procdefcoll^.data.mangledname,0)); end; end; procdefcoll:=procdefcoll^.next; @@ -1310,7 +1310,7 @@ implementation { it is not written for parents that don't have any vmt !! } if assigned(_class.childof) and (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 current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 824379bd48..942e244b88 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -164,7 +164,7 @@ implementation begin If (hp.u.flags and uf_threadvars)=uf_threadvars then 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); end; hp:=tused_unit(hp.next); @@ -172,7 +172,7 @@ implementation { Add program threadvars, if any } If (current_module.flags and uf_threadvars)=uf_threadvars then 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); end; { Insert TableCount at start } @@ -195,7 +195,7 @@ implementation (vo_is_thread_var in tglobalvarsym(p).varoptions) then begin { 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 } ltvTable.concat(tai_const.create_32bit(tglobalvarsym(p).getsize)); end; @@ -255,7 +255,7 @@ implementation begin { Valid pointer to resource information } 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} current_module.linkotherofiles.add('resptrs.o',link_always); {$else EXTERNALRESPTRS} @@ -291,8 +291,8 @@ implementation begin If (hp.flags and uf_has_resourcestrings)=uf_has_resourcestrings then 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); end; hp:=tmodule(hp.next); @@ -324,11 +324,11 @@ implementation if (hp.u.flags and (uf_init or uf_finalize))<>0 then begin 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 unitinits.concat(Tai_const.Create_sym(nil)); 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 unitinits.concat(Tai_const.Create_sym(nil)); inc(count); @@ -339,11 +339,11 @@ implementation if (current_module.flags and (uf_init or uf_finalize))<>0 then begin 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 unitinits.concat(Tai_const.Create_sym(nil)); 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 unitinits.concat(Tai_const.Create_sym(nil)); inc(count); diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index 59cbb878f1..e8163ac8f5 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/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_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_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); href.refaddr := addr_hi; 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_symbol.Create(l1,0)); 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; @@ -398,7 +398,7 @@ const with some restore code.} if (target_info.system <> system_powerpc_darwin) then 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 list.concat(taicpu.op_none(A_NOP)); end @@ -907,7 +907,7 @@ const if (target_info.system = system_powerpc_darwin) then p := taicpu.op_sym(A_B,get_darwin_call_stub(s)) 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; list.concat(p) end; @@ -1112,11 +1112,11 @@ const { save floating-point registers if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then 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; end 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); @@ -1138,11 +1138,11 @@ const { if cs_create_pic in aktmoduleswitches then 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; end 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 ((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)); { 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 { 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; } end; @@ -2003,7 +2001,7 @@ const end { case 0 } 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)); end; diff --git a/compiler/powerpc/nppccal.pas b/compiler/powerpc/nppccal.pas index aecfc2b409..b596223460 100644 --- a/compiler/powerpc/nppccal.pas +++ b/compiler/powerpc/nppccal.pas @@ -85,7 +85,7 @@ implementation cg.getcpuregister(current_asmdata.CurrAsmList,NR_R31); 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; current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R31,tmpref)); tmpref.base:=NR_R31; diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index afb5b23f59..d91b0dc941 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/compiler/powerpc64/cgcpu.pas @@ -563,8 +563,7 @@ procedure tcgppc.a_call_name_direct(list: TAsmList; s: string; prependDot : bool begin if (prependDot) then 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 list.concat(taicpu.op_none(A_NOP)); @@ -1196,8 +1195,7 @@ procedure tcgppc.a_jmp_name(list: TAsmList; const s: string); var p: taicpu; 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; list.concat(p) end; @@ -1893,9 +1891,7 @@ begin op_onr11methodaddr; end else {$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)); end; @@ -1927,7 +1923,7 @@ begin symname := '_$' + current_asmdata.name + '$got$' + symbol; l:=current_asmdata.getasmsymbol(symname); 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_symbol.create_global(l,0)); current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol)); @@ -2145,8 +2141,7 @@ var p: taicpu; 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 create_cond_norm(c, crval, p.condition); p.is_jmp := true; @@ -2169,7 +2164,7 @@ begin symname := '_$' + current_asmdata.name + '$toc$' + hexstr(a, sizeof(a)*2); l:=current_asmdata.getasmsymbol(symname); 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_symbol.create_global(l,0)); current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a))); diff --git a/compiler/psub.pas b/compiler/psub.pas index 512b5734eb..4dafe8d221 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1543,9 +1543,9 @@ implementation begin if (po_global in pd.procoptions) or (cs_profile in aktmoduleswitches) then - current_asmdata.newasmsymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) + current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) else - current_asmdata.newasmsymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); + current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); end; current_procinfo:=old_current_procinfo; diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index 411c5e1be2..5211704b9b 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -249,8 +249,8 @@ implementation begin if not Tobjectdef(pointertype.def).is_related(Tobjectdef(pointertype.def)) then 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; niln: datalist.concat(Tai_const.Create_sym(nil)); @@ -413,17 +413,17 @@ implementation if po_abstractmethod in tprocsym(srsym).first_procdef.procoptions then Message(type_e_cant_take_address_of_abstract_method) 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; globalvarsym : - datalist.concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,AT_DATA,offset)); + datalist.concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,offset)); typedconstsym : - datalist.concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset)); + datalist.concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,offset)); labelsym : - datalist.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_LABEL,offset)); + datalist.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,offset)); constsym : 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 Message(type_e_variable_id_expected); else @@ -441,7 +441,7 @@ implementation if (tinlinenode(p).left.nodetype=typen) then begin 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 else Message(parser_e_illegal_expression); @@ -740,7 +740,7 @@ implementation (tloadnode(p).symtableentry.typ=procsym) then begin datalist.concat(Tai_const.createname( - tprocsym(tloadnode(p).symtableentry).first_procdef.mangledname,AT_FUNCTION,0)); + tprocsym(tloadnode(p).symtableentry).first_procdef.mangledname,0)); end else Message(parser_e_illegal_expression); @@ -942,7 +942,7 @@ implementation begin for i:=1 to vmt_offset-aktpos do 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 } aktpos:=vmt_offset + sizeof(aint); end; @@ -968,7 +968,7 @@ implementation begin for i:=1 to tobjectdef(t.def).vmt_offset-aktpos do 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 } aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint); end; diff --git a/compiler/raatt.pas b/compiler/raatt.pas index fba609d7eb..376b5137b5 100644 --- a/compiler/raatt.pas +++ b/compiler/raatt.pas @@ -1522,7 +1522,7 @@ unit raatt; begin oper.opr.typ:=OPR_SYMBOL; oper.opr.symofs:=l; - oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); + oper.opr.symbol:=current_asmdata.RefAsmSymbol(tempstr); end else begin diff --git a/compiler/rautils.pas b/compiler/rautils.pas index 0020537b5f..e61dd3da69 100644 --- a/compiler/rautils.pas +++ b/compiler/rautils.pas @@ -810,7 +810,7 @@ Begin staticsymtable : begin initref; - opr.ref.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA); + opr.ref.symbol:=current_asmdata.RefAsmSymbol(tglobalvarsym(sym).mangledname); end; parasymtable, localsymtable : @@ -872,7 +872,7 @@ Begin typedconstsym : begin 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 orddef, enumdef, @@ -920,7 +920,7 @@ Begin Message(asmr_w_calling_overload_func); l:=opr.ref.offset; 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; hasvar:=true; SetupVar:=TRUE; @@ -1484,7 +1484,7 @@ end; Procedure ConcatConstSymbol(p : TAsmList;const sym:string;symtyp:tasmsymtype;l:aint); begin - p.concat(Tai_const.Createname(sym,symtyp,l)); + p.concat(Tai_const.Createname(sym,l)); end; diff --git a/compiler/sparc/cgcpu.pas b/compiler/sparc/cgcpu.pas index 1a40a2bff0..d88edd6b45 100644 --- a/compiler/sparc/cgcpu.pas +++ b/compiler/sparc/cgcpu.pas @@ -427,7 +427,7 @@ implementation procedure TCgSparc.a_call_name(list:TAsmList;const s:string); 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 } list.concat(taicpu.op_none(A_NOP)); end; @@ -883,7 +883,7 @@ implementation procedure TCgSparc.a_jmp_always(List:TAsmList;l:TAsmLabel); 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 } list.Concat(TAiCpu.Op_none(A_NOP)); end; @@ -891,7 +891,7 @@ implementation procedure tcgsparc.a_jmp_name(list : TAsmList;const s : string); 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 } list.Concat(TAiCpu.Op_none(A_NOP)); end; @@ -1298,7 +1298,7 @@ implementation list.concat(taicpu.op_reg(A_JMP,NR_L1)); end 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 } list.Concat(TAiCpu.Op_none(A_NOP)); diff --git a/compiler/sparc/racpugas.pas b/compiler/sparc/racpugas.pas index 254b1883fb..842d014b2c 100644 --- a/compiler/sparc/racpugas.pas +++ b/compiler/sparc/racpugas.pas @@ -343,7 +343,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.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp) + oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr) else Message(asmr_e_cant_have_multiple_relocatable_symbols); case oper.opr.typ of diff --git a/compiler/symdef.pas b/compiler/symdef.pas index cf78d98c4e..8afb0e1aea 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -4732,7 +4732,7 @@ implementation exit; if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then 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; end else @@ -4887,7 +4887,7 @@ implementation hp:=tproptablelistitem(proptablelist.first); while assigned(hp) do 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); end; @@ -4951,7 +4951,7 @@ implementation if not(objecttype in [odt_interfacecom,odt_interfacecorba]) then begin 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 current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil)); end; diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 3a6cb3ec8b..f509913fe3 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -2338,7 +2338,7 @@ implementation begin { the label is always a global label } if not assigned(lab) then - lab:=current_asmdata.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA); + lab:=current_asmdata.RefAsmSymbol(mangledname); get_label:=lab; end; diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index 70dcc3852d..8c0782d31e 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -167,7 +167,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)); - 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^)); {$endif i386} end; diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index ac122cd28b..e5dd431132 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -231,7 +231,7 @@ begin (target_info.system in [system_i386_freebsd]) then begin {$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); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index 15707b5b2b..ca5323de2d 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -179,7 +179,7 @@ begin (target_info.system in [system_x86_64_linux,system_i386_linux]) then begin {$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); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic diff --git a/compiler/systems/t_nwl.pas b/compiler/systems/t_nwl.pas index 1a7ad4496e..45c3a2dd61 100644 --- a/compiler/systems/t_nwl.pas +++ b/compiler/systems/t_nwl.pas @@ -244,7 +244,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)); - 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^)); {$endif i386} end; diff --git a/compiler/systems/t_nwm.pas b/compiler/systems/t_nwm.pas index e691b67f4a..e4a07b6ab2 100644 --- a/compiler/systems/t_nwm.pas +++ b/compiler/systems/t_nwm.pas @@ -236,7 +236,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)); - 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^)); {$endif i386} end; diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index b83d2606c0..50b8785891 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -525,7 +525,7 @@ unit cgx86; procedure tcgx86.a_jmp_name(list : TAsmList;const s : string); 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; @@ -550,7 +550,7 @@ unit cgx86; current_asmdata.asmlists[al_imports]:=TAsmList.create; 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_directive.create(asd_indirect_symbol,s)); 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 begin - sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.RefAsmSymbol(s); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then begin @@ -595,7 +595,7 @@ unit cgx86; sym : tasmsymbol; r : treference; begin - sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.RefAsmSymbol(s); reference_reset_symbol(r,sym,0); r.refaddr:=addr_full; list.concat(taicpu.op_ref(A_CALL,S_NO,r)); @@ -808,8 +808,7 @@ unit cgx86; system_i386_linux: if segment=NR_GS then 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; list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r)); end diff --git a/compiler/x86/nx86inl.pas b/compiler/x86/nx86inl.pas index ed0ed844bc..57ec6602f5 100644 --- a/compiler/x86/nx86inl.pas +++ b/compiler/x86/nx86inl.pas @@ -225,11 +225,9 @@ implementation location:=left.location; case tfloatdef(resulttype.def).typ of 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: - 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 internalerror(200506081); end; diff --git a/compiler/x86_64/cgcpu.pas b/compiler/x86_64/cgcpu.pas index b20f3a2144..17f21d1215 100644 --- a/compiler/x86_64/cgcpu.pas +++ b/compiler/x86_64/cgcpu.pas @@ -128,7 +128,7 @@ unit cgcpu; end else begin - sym:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.RefAsmSymbol(procdef.mangledname); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic