+ introduced TAsmData.RefAsmSymbolByClass - similar to RefAsmSymbol, but allows

to create a subclass of TAsmSymbol even in the case of external symbol.
This commit is contained in:
Nikolay Nikolov 2024-02-25 07:15:18 +02:00
parent 81d98f5ae2
commit 26a2ae92ad

View File

@ -215,6 +215,7 @@ interface
function DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef) : TAsmSymbol;
function DefineProcAsmSymbol(pd: tdef; const s: TSymStr; global: boolean): TAsmSymbol;
function WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
function RefAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_typ:Tasmsymtype;indirect:boolean=false) : TAsmSymbol;
function RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean=false) : TAsmSymbol;
function GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
{ create new assembler label }
@ -609,7 +610,8 @@ implementation
result:=DefineAsmSymbol(s,AB_LOCAL,AT_FUNCTION,pd);
end;
function TAsmData.RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean) : TAsmSymbol;
function TAsmData.RefAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_typ:Tasmsymtype;indirect:boolean) : TAsmSymbol;
var
namestr : TSymStr;
bind : tasmsymbind;
@ -626,13 +628,19 @@ implementation
end;
result:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
if not assigned(result) then
result:=TAsmSymbol.create(AsmSymbolDict,namestr,bind,_typ)
result:=symclass.create(AsmSymbolDict,namestr,bind,_typ)
{ one normal reference removes the "weak" character of a symbol }
else if (result.bind=AB_WEAK_EXTERNAL) then
result.bind:=bind;
end;
function TAsmData.RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean) : TAsmSymbol;
begin
result:=RefAsmSymbolByClass(TAsmSymbol,s,_typ,indirect);
end;
function TAsmData.WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
begin
result:=TAsmSymbol(FAsmSymbolDict.Find(s));