mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-06 11:50:37 +01:00
* specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
o will be used to automatically generate AB_INDIRECT sybols when
necessary
git-svn-id: trunk@34164 -
This commit is contained in:
parent
53ace5b489
commit
1cb8c0d00c
@ -158,9 +158,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
list.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
list.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
list.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
list.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
procdef.init_paraloc_info(callerside);
|
||||
|
||||
@ -993,7 +993,7 @@ implementation
|
||||
end
|
||||
else if tcalo_vectorized_dead_strip_item in options then
|
||||
begin
|
||||
sym:=current_asmdata.DefineAsmSymbol(make_mangledname(basename,st,itemname),AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol(make_mangledname(basename,st,itemname),AB_GLOBAL,AT_DATA,def);
|
||||
if not customsecname then
|
||||
secname:=make_mangledname(basename,st,'2_'+itemname);
|
||||
exclude(options,tcalo_vectorized_dead_strip_item);
|
||||
@ -1382,7 +1382,7 @@ implementation
|
||||
else
|
||||
name:=make_mangledname(basename,st,'END');
|
||||
if define then
|
||||
result:=current_asmdata.DefineAsmSymbol(name,AB_GLOBAL,AT_DATA)
|
||||
result:=current_asmdata.DefineAsmSymbol(name,AB_GLOBAL,AT_DATA,voidpointertype)
|
||||
else
|
||||
result:=current_asmdata.RefAsmSymbol(name,AT_DATA)
|
||||
end;
|
||||
|
||||
@ -159,6 +159,8 @@ interface
|
||||
FAsmCFI : TAsmCFI;
|
||||
FConstPools : array[TConstPoolType] of THashSet;
|
||||
function GetConstPools(APoolType: TConstPoolType): THashSet;
|
||||
protected
|
||||
function DefineAsmSymbolByClassBase(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef; out wasdefined: boolean) : TAsmSymbol;
|
||||
public
|
||||
name : pshortstring; { owned by tmodule }
|
||||
NextVTEntryNr : longint;
|
||||
@ -170,8 +172,8 @@ interface
|
||||
constructor create(n: pshortstring);
|
||||
destructor destroy;override;
|
||||
{ asmsymbol }
|
||||
function DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
|
||||
function DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
|
||||
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 GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
|
||||
@ -344,6 +346,55 @@ implementation
|
||||
Result := FConstPools[APoolType];
|
||||
end;
|
||||
|
||||
|
||||
function TAsmData.DefineAsmSymbolByClassBase(symclass: TAsmSymbolClass; const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef; out wasdefined: boolean): TAsmSymbol;
|
||||
var
|
||||
hp : TAsmSymbol;
|
||||
namestr : TSymStr;
|
||||
begin
|
||||
namestr:=s;
|
||||
if _bind in asmsymbindindirect then
|
||||
namestr:=namestr+suffix_indirect;
|
||||
hp:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
|
||||
if assigned(hp) then
|
||||
begin
|
||||
{ Redefine is allowed, but the types must be the same. The redefine
|
||||
is needed for Darwin where the labels are first allocated }
|
||||
wasdefined:=not(hp.bind in [AB_EXTERNAL,AB_WEAK_EXTERNAL]);
|
||||
if wasdefined then
|
||||
begin
|
||||
if (hp.bind<>_bind) and
|
||||
(hp.typ<>_typ) then
|
||||
internalerror(200603261);
|
||||
end;
|
||||
hp.typ:=_typ;
|
||||
{ Changing bind from AB_GLOBAL to AB_LOCAL is wrong
|
||||
if bind is already AB_GLOBAL or AB_EXTERNAL,
|
||||
GOT might have been used, so change might be harmful. }
|
||||
if (_bind<>hp.bind) and (hp.getrefs>0) then
|
||||
begin
|
||||
{$ifdef extdebug}
|
||||
{ the changes that matter must become internalerrors, the rest
|
||||
should be ignored; a used cannot change anything about this,
|
||||
so printing a warning/hint is not useful }
|
||||
if (_bind=AB_LOCAL) then
|
||||
Message3(asmw_w_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind])
|
||||
else
|
||||
Message3(asmw_h_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind]);
|
||||
{$endif extdebug}
|
||||
end;
|
||||
hp.bind:=_bind;
|
||||
end
|
||||
else
|
||||
begin
|
||||
wasdefined:=false;
|
||||
{ Not found, insert it. }
|
||||
hp:=symclass.create(AsmSymbolDict,namestr,_bind,_typ);
|
||||
end;
|
||||
result:=hp;
|
||||
end;
|
||||
|
||||
|
||||
constructor TAsmData.create(n:pshortstring);
|
||||
var
|
||||
alt : TAsmLabelType;
|
||||
@ -407,56 +458,17 @@ implementation
|
||||
FConstPools[hp].Free;
|
||||
end;
|
||||
|
||||
|
||||
function TAsmData.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
|
||||
function TAsmData.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef): TAsmSymbol;
|
||||
var
|
||||
hp : TAsmSymbol;
|
||||
namestr : TSymStr;
|
||||
wasdefined: boolean;
|
||||
begin
|
||||
namestr:=s;
|
||||
if _bind in asmsymbindindirect then
|
||||
namestr:=namestr+suffix_indirect;
|
||||
hp:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
|
||||
if assigned(hp) then
|
||||
begin
|
||||
{ Redefine is allowed, but the types must be the same. The redefine
|
||||
is needed for Darwin where the labels are first allocated }
|
||||
if not(hp.bind in [AB_EXTERNAL,AB_WEAK_EXTERNAL]) then
|
||||
begin
|
||||
if (hp.bind<>_bind) and
|
||||
(hp.typ<>_typ) then
|
||||
internalerror(200603261);
|
||||
end;
|
||||
hp.typ:=_typ;
|
||||
{ Changing bind from AB_GLOBAL to AB_LOCAL is wrong
|
||||
if bind is already AB_GLOBAL or AB_EXTERNAL,
|
||||
GOT might have been used, so change might be harmful. }
|
||||
if (_bind<>hp.bind) and (hp.getrefs>0) then
|
||||
begin
|
||||
{$ifdef extdebug}
|
||||
{ the changes that matter must become internalerrors, the rest
|
||||
should be ignored; a used cannot change anything about this,
|
||||
so printing a warning/hint is not useful }
|
||||
if (_bind=AB_LOCAL) then
|
||||
Message3(asmw_w_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind])
|
||||
else
|
||||
Message3(asmw_h_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind]);
|
||||
{$endif extdebug}
|
||||
end;
|
||||
hp.bind:=_bind;
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ Not found, insert it. }
|
||||
hp:=symclass.create(AsmSymbolDict,namestr,_bind,_typ);
|
||||
end;
|
||||
result:=hp;
|
||||
result:=DefineAsmSymbolByClassBase(symclass,s,_bind,_typ,def,wasdefined);
|
||||
end;
|
||||
|
||||
|
||||
function TAsmData.DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
|
||||
function TAsmData.DefineAsmSymbol(const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef): TAsmSymbol;
|
||||
begin
|
||||
result:=DefineAsmSymbolByClass(TAsmSymbol,s,_bind,_typ);
|
||||
result:=DefineAsmSymbolByClass(TAsmSymbol,s,_bind,_typ,def);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -497,9 +497,9 @@ interface
|
||||
has_value : boolean;
|
||||
constructor Create(_sym:tasmsymbol;siz:longint);
|
||||
constructor Create_Global(_sym:tasmsymbol;siz:longint);
|
||||
constructor Createname(const _name : string;_symtyp:Tasmsymtype;siz:longint);
|
||||
constructor Createname_global(const _name : string;_symtyp:Tasmsymtype;siz:longint);
|
||||
constructor Createname_global_value(const _name : string;_symtyp:Tasmsymtype;siz:longint;val:ptruint);
|
||||
constructor Createname(const _name : string;_symtyp:Tasmsymtype;siz:longint;def:tdef);
|
||||
constructor Createname_global(const _name : string;_symtyp:Tasmsymtype;siz:longint;def:tdef);
|
||||
constructor Createname_global_value(const _name : string;_symtyp:Tasmsymtype;siz:longint;val:ptruint;def:tdef);
|
||||
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||
procedure derefimpl;override;
|
||||
@ -574,8 +574,8 @@ interface
|
||||
is_global : boolean;
|
||||
sym : tasmsymbol;
|
||||
size : asizeint;
|
||||
constructor Create(const _name : string;_size : asizeint);
|
||||
constructor Create_global(const _name : string;_size : asizeint);
|
||||
constructor Create(const _name : string;_size : asizeint; def: tdef);
|
||||
constructor Create_global(const _name : string;_size : asizeint; def: tdef);
|
||||
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||
procedure derefimpl;override;
|
||||
@ -1193,12 +1193,12 @@ implementation
|
||||
TAI_DATABLOCK
|
||||
****************************************************************************}
|
||||
|
||||
constructor tai_datablock.Create(const _name : string;_size : asizeint);
|
||||
constructor tai_datablock.Create(const _name : string;_size : asizeint; def: tdef);
|
||||
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_datablock;
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA,def);
|
||||
{ keep things aligned }
|
||||
if _size<=0 then
|
||||
_size:=sizeof(aint);
|
||||
@ -1207,11 +1207,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
constructor tai_datablock.Create_global(const _name : string;_size : asizeint);
|
||||
constructor tai_datablock.Create_global(const _name : string;_size : asizeint; def: tdef);
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_datablock;
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA,def);
|
||||
{ keep things aligned }
|
||||
if _size<=0 then
|
||||
_size:=sizeof(aint);
|
||||
@ -1275,29 +1275,29 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
constructor tai_symbol.Createname(const _name : string;_symtyp:Tasmsymtype;siz:longint);
|
||||
constructor tai_symbol.Createname(const _name : string;_symtyp:Tasmsymtype;siz:longint;def:tdef);
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_symbol;
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_symtyp);
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_symtyp,def);
|
||||
size:=siz;
|
||||
is_global:=false;
|
||||
end;
|
||||
|
||||
|
||||
constructor tai_symbol.Createname_global(const _name : string;_symtyp:Tasmsymtype;siz:longint);
|
||||
constructor tai_symbol.Createname_global(const _name : string;_symtyp:Tasmsymtype;siz:longint;def:tdef);
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_symbol;
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_symtyp);
|
||||
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_symtyp,def);
|
||||
size:=siz;
|
||||
is_global:=true;
|
||||
end;
|
||||
|
||||
|
||||
constructor tai_symbol.createname_global_value(const _name: string;_symtyp: tasmsymtype; siz: longint; val: ptruint);
|
||||
constructor tai_symbol.createname_global_value(const _name: string;_symtyp: tasmsymtype; siz: longint; val: ptruint;def:tdef);
|
||||
begin
|
||||
Createname_global(_name,_symtyp,siz);
|
||||
Createname_global(_name,_symtyp,siz,def);
|
||||
value:=val;
|
||||
has_value:=true;
|
||||
end;
|
||||
|
||||
@ -311,7 +311,7 @@ implementation
|
||||
|
||||
uses
|
||||
itcpugas,aoptcpu,
|
||||
systems;
|
||||
systems,symdef;
|
||||
|
||||
|
||||
procedure taicpu.loadshifterop(opidx:longint;const so:tshifterop);
|
||||
@ -1747,7 +1747,7 @@ implementation
|
||||
new_section(prolog,sec_code,'FPC_EH_PROLOG',sizeof(pint),secorder_begin);
|
||||
prolog.concat(Tai_const.Createname('_ARM_ExceptionHandler', 0));
|
||||
prolog.concat(Tai_const.Create_32bit(0));
|
||||
prolog.concat(Tai_symbol.Createname_global('FPC_EH_CODE_START',AT_DATA,0));
|
||||
prolog.concat(Tai_symbol.Createname_global('FPC_EH_CODE_START',AT_METADATA,0,voidpointertype));
|
||||
{ dummy function }
|
||||
prolog.concat(taicpu.op_reg_reg(A_MOV,NR_R15,NR_R14));
|
||||
current_asmdata.asmlists[al_start].insertList(prolog);
|
||||
|
||||
@ -177,9 +177,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
list.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
list.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
list.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
list.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ the wrapper might need aktlocaldata for the additional data to
|
||||
load the constant }
|
||||
|
||||
@ -167,7 +167,7 @@ implementation
|
||||
begin
|
||||
header:=TAsmList.create;
|
||||
new_section(header, sec_code, 'FPC_INIT_FUNC_TABLE', 1);
|
||||
header.concat(tai_symbol.Createname_global('FPC_INIT_FUNC_TABLE',AT_FUNCTION,0));
|
||||
header.concat(tai_symbol.Createname_global('FPC_INIT_FUNC_TABLE',AT_FUNCTION,0,voidcodepointertype));
|
||||
|
||||
initList.insertList(header);
|
||||
header.free;
|
||||
@ -178,7 +178,7 @@ implementation
|
||||
begin
|
||||
header:=TAsmList.create;
|
||||
new_section(header, sec_code, 'FPC_FINALIZE_FUNC_TABLE', 1);
|
||||
header.concat(tai_symbol.Createname_global('FPC_FINALIZE_FUNC_TABLE',AT_FUNCTION,0));
|
||||
header.concat(tai_symbol.Createname_global('FPC_FINALIZE_FUNC_TABLE',AT_FUNCTION,0,voidcodepointertype));
|
||||
|
||||
finalList.insertList(header);
|
||||
header.free;
|
||||
|
||||
@ -2392,7 +2392,7 @@ implementation
|
||||
if not(assigned(l)) then
|
||||
begin
|
||||
new_section(current_asmdata.asmlists[al_picdata],sec_data_nonlazy,'',sizeof(pint));
|
||||
l:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA);
|
||||
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))
|
||||
|
||||
@ -976,10 +976,10 @@ implementation
|
||||
(def.owner.symtabletype=globalsymtable) and
|
||||
(def.owner.iscurrentunit) then
|
||||
begin
|
||||
result^.lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA);
|
||||
result^.ref_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBGREF',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA);
|
||||
result^.lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA,voidpointertype);
|
||||
result^.ref_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBGREF',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA,voidpointertype);
|
||||
if needstructdeflab then
|
||||
result^.struct_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG2',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA);
|
||||
result^.struct_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG2',def.owner,symname(def.typesym, true)),AB_GLOBAL,AT_METADATA,voidpointertype);
|
||||
include(def.defstates,ds_dwarf_dbg_info_written);
|
||||
end
|
||||
else
|
||||
@ -1289,7 +1289,7 @@ implementation
|
||||
else
|
||||
begin
|
||||
AddConstToAbbrev(ord(DW_FORM_ref4));
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA),sym));
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA,voidpointertype),sym));
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2999,9 +2999,9 @@ implementation
|
||||
dbgname:='L'+dbgname;
|
||||
new_section(current_asmdata.asmlists[al_start],sec_code,dbgname,0,secorder_begin);
|
||||
if not(target_info.system in systems_darwin) then
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0))
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype))
|
||||
else
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname(dbgname,AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype));
|
||||
|
||||
dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,'');
|
||||
{ See above. }
|
||||
@ -3009,27 +3009,27 @@ implementation
|
||||
dbgname:='L'+dbgname;
|
||||
new_section(current_asmdata.asmlists[al_end],sec_code,dbgname,0,secorder_end);
|
||||
if not(target_info.system in systems_darwin) then
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0))
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype))
|
||||
else
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname(dbgname,AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype));
|
||||
|
||||
{ insert .Ldebug_abbrev0 label }
|
||||
templist:=TAsmList.create;
|
||||
new_section(templist,sec_debug_abbrev,'',0);
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_abbrevsection0',AT_METADATA,0));
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_abbrevsection0',AT_METADATA,0,voidpointertype));
|
||||
{ add any extra stuff which needs to be in the abbrev section, but before }
|
||||
{ the actual abbreviations, in between the symbol above and below, i.e. here }
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_abbrev0',AT_METADATA,0));
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_abbrev0',AT_METADATA,0,voidpointertype));
|
||||
current_asmdata.asmlists[al_start].insertlist(templist);
|
||||
templist.free;
|
||||
|
||||
{ insert .Ldebug_line0 label }
|
||||
templist:=TAsmList.create;
|
||||
new_section(templist,sec_debug_line,'',0);
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_linesection0',AT_METADATA,0));
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_linesection0',AT_METADATA,0,voidpointertype));
|
||||
{ add any extra stuff which needs to be in the line section, but before }
|
||||
{ the actual line info, in between the symbol above and below, i.e. here }
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_line0',AT_METADATA,0));
|
||||
templist.concat(tai_symbol.createname(target_asm.labelprefix+'debug_line0',AT_METADATA,0,voidpointertype));
|
||||
current_asmdata.asmlists[al_start].insertlist(templist);
|
||||
templist.free;
|
||||
|
||||
@ -3047,7 +3047,7 @@ implementation
|
||||
if use_64bit_headers then
|
||||
linelist.concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
|
||||
linelist.concat(tai_const.create_rel_sym(offsetreltype,
|
||||
lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_line0',AB_LOCAL,AT_METADATA)));
|
||||
lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_line0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
linelist.concat(tai_label.create(lbl));
|
||||
|
||||
{ version }
|
||||
@ -3056,7 +3056,7 @@ implementation
|
||||
{ header length }
|
||||
current_asmdata.getlabel(lbl,alt_dbgfile);
|
||||
linelist.concat(tai_const.create_rel_sym(offsetreltype,
|
||||
lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'ehdebug_line0',AB_LOCAL,AT_METADATA)));
|
||||
lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'ehdebug_line0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
linelist.concat(tai_label.create(lbl));
|
||||
|
||||
{ minimum_instruction_length }
|
||||
@ -3142,14 +3142,14 @@ implementation
|
||||
linelist.concat(tai_const.create_8bit(0));
|
||||
|
||||
{ end of debug line header }
|
||||
linelist.concat(tai_symbol.createname(target_asm.labelprefix+'ehdebug_line0',AT_METADATA,0));
|
||||
linelist.concat(tai_symbol.createname(target_asm.labelprefix+'ehdebug_line0',AT_METADATA,0,voidpointertype));
|
||||
linelist.concat(tai_comment.Create(strpnew('=== header end ===')));
|
||||
|
||||
{ add line program }
|
||||
linelist.concatList(asmline);
|
||||
|
||||
{ end of debug line table }
|
||||
linelist.concat(tai_symbol.createname(target_asm.labelprefix+'edebug_line0',AT_METADATA,0));
|
||||
linelist.concat(tai_symbol.createname(target_asm.labelprefix+'edebug_line0',AT_METADATA,0,voidpointertype));
|
||||
|
||||
flist.free;
|
||||
end;
|
||||
@ -3195,7 +3195,7 @@ implementation
|
||||
|
||||
{ write start labels }
|
||||
new_section(current_asmdata.asmlists[al_dwarf_info],sec_debug_info,'',0);
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'debug_info0',AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'debug_info0',AT_METADATA,0,voidpointertype));
|
||||
|
||||
{ start abbrev section }
|
||||
new_section(current_asmdata.asmlists[al_dwarf_abbrev],sec_debug_abbrev,'',0);
|
||||
@ -3210,7 +3210,7 @@ implementation
|
||||
if use_64bit_headers then
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_rel_sym(offsetreltype,
|
||||
arangestartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'earanges0',AB_LOCAL,AT_METADATA)));
|
||||
arangestartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'earanges0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_label.create(arangestartlabel));
|
||||
|
||||
@ -3218,11 +3218,11 @@ implementation
|
||||
|
||||
if not(tf_dwarf_relative_addresses in target_info.flags) then
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_type_sym(offsetabstype,
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA)))
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA,voidpointertype)))
|
||||
else
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_rel_sym(offsetreltype,
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_infosection0',AB_LOCAL,AT_METADATA),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA)));
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_infosection0',AB_LOCAL,AT_METADATA,voidpointertype),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(sizeof(pint)));
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(0));
|
||||
@ -3239,7 +3239,7 @@ implementation
|
||||
if use_64bit_headers then
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,
|
||||
lenstartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_info0',AB_LOCAL,AT_METADATA)));
|
||||
lenstartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_info0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_label.create(lenstartlabel));
|
||||
{ version }
|
||||
@ -3247,11 +3247,11 @@ implementation
|
||||
{ abbrev table (=relative from section start)}
|
||||
if not(tf_dwarf_relative_addresses in target_info.flags) then
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype,
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_METADATA)))
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_METADATA,voidpointertype)))
|
||||
else
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrevsection0',AB_LOCAL,AT_METADATA),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_METADATA)));
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrevsection0',AB_LOCAL,AT_METADATA,voidpointertype),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
||||
|
||||
{ address size }
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sizeof(pint)));
|
||||
@ -3266,11 +3266,11 @@ implementation
|
||||
|
||||
{ reference to line info section }
|
||||
if not(tf_dwarf_relative_addresses in target_info.flags) then
|
||||
append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA))
|
||||
append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA,voidpointertype))
|
||||
else
|
||||
append_labelentry_dataptr_rel(DW_AT_stmt_list,
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_linesection0',AB_LOCAL,AT_METADATA),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA));
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_linesection0',AB_LOCAL,AT_METADATA,voidpointertype),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA,voidpointertype));
|
||||
|
||||
if (m_objectivec1 in current_settings.modeswitches) then
|
||||
append_attribute(DW_AT_APPLE_major_runtime_vers,DW_FORM_data1,[1]);
|
||||
@ -3283,11 +3283,11 @@ implementation
|
||||
end
|
||||
else
|
||||
bind:=AB_GLOBAL;
|
||||
append_labelentry(DW_AT_low_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA));
|
||||
append_labelentry(DW_AT_low_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype));
|
||||
dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,'');
|
||||
if (target_info.system in systems_darwin) then
|
||||
dbgname:='L'+dbgname;
|
||||
append_labelentry(DW_AT_high_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA));
|
||||
append_labelentry(DW_AT_high_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype));
|
||||
|
||||
finish_entry;
|
||||
|
||||
@ -3322,7 +3322,7 @@ implementation
|
||||
finish_children;
|
||||
|
||||
{ end of debug info table }
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'edebug_info0',AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'edebug_info0',AT_METADATA,0,voidpointertype));
|
||||
|
||||
{ end of abbrev table }
|
||||
current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_8bit(0));
|
||||
@ -3332,7 +3332,7 @@ implementation
|
||||
{ end of aranges table }
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_symbol.createname(target_asm.labelprefix+'earanges0',AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_symbol.createname(target_asm.labelprefix+'earanges0',AT_METADATA,0,voidpointertype));
|
||||
end;
|
||||
|
||||
{ reset all def debug states }
|
||||
|
||||
@ -1675,7 +1675,7 @@ implementation
|
||||
if not(target_info.system in systems_darwin) then
|
||||
begin
|
||||
new_section(current_asmdata.asmlists[al_stabs],sec_data,GetSymTableName(current_module.localsymtable),sizeof(pint));
|
||||
current_asmdata.asmlists[al_stabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_stabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_METADATA,0,voidpointertype));
|
||||
end
|
||||
else
|
||||
new_section(current_asmdata.asmlists[al_stabs],sec_code,GetSymTableName(current_module.localsymtable),sizeof(pint));
|
||||
@ -1813,7 +1813,7 @@ implementation
|
||||
infile:=current_module.sourcefiles.get_file(1);
|
||||
new_section(current_asmdata.asmlists[al_start],sec_code,make_mangledname('DEBUGSTART',current_module.localsymtable,''),sizeof(pint),secorder_begin);
|
||||
if not(target_info.system in systems_darwin) then
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(make_mangledname('DEBUGSTART',current_module.localsymtable,''),AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(make_mangledname('DEBUGSTART',current_module.localsymtable,''),AT_METADATA,0,voidpointertype));
|
||||
current_asmdata.asmlists[al_start].concat(Tai_stab.Create_str(stabsdir,'"'+BsToSlash(FixPath(getcurrentdir,false))+'",'+
|
||||
base_stabs_str(stabs_n_sourcefile,'0','0',hlabel.name)));
|
||||
current_asmdata.asmlists[al_start].concat(Tai_stab.Create_str(stabsdir,'"'+BsToSlash(FixPath(infile.path,false))+FixFileName(infile.name)+'",'+
|
||||
@ -1828,7 +1828,7 @@ implementation
|
||||
current_asmdata.getlabel(hlabel,alt_dbgfile);
|
||||
new_section(current_asmdata.asmlists[al_end],sec_code,make_mangledname('DEBUGEND',current_module.localsymtable,''),sizeof(pint),secorder_end);
|
||||
if not(target_info.system in systems_darwin) then
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(make_mangledname('DEBUGEND',current_module.localsymtable,''),AT_METADATA,0));
|
||||
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(make_mangledname('DEBUGEND',current_module.localsymtable,''),AT_METADATA,0,voidpointertype));
|
||||
current_asmdata.asmlists[al_end].concat(Tai_stab.Create_str(stabsdir,'"",'+base_stabs_str(stabs_n_sourcefile,'0','0',hlabel.name)));
|
||||
current_asmdata.asmlists[al_end].concat(tai_label.create(hlabel));
|
||||
end;
|
||||
@ -1846,7 +1846,7 @@ implementation
|
||||
{ make sure the debuginfo doesn't get stripped out }
|
||||
if (target_info.system in systems_darwin) then
|
||||
begin
|
||||
dbgtable:=tai_symbol.createname('DEBUGINFOTABLE',AT_METADATA,0);
|
||||
dbgtable:=tai_symbol.createname('DEBUGINFOTABLE',AT_METADATA,0,voidpointertype);
|
||||
list.concat(tai_directive.create(asd_no_dead_strip,dbgtable.sym.name));
|
||||
list.concat(dbgtable);
|
||||
end;
|
||||
|
||||
@ -254,7 +254,7 @@ implementation
|
||||
result:=inherited gen_procdef_endsym_stabs(def);
|
||||
if not assigned(def.procstarttai) then
|
||||
exit;
|
||||
procendsymbol:=current_asmdata.DefineAsmSymbol('LT..'+ReplaceForbiddenAsmSymbolChars(def.mangledname),AB_LOCAL,AT_ADDR);
|
||||
procendsymbol:=current_asmdata.DefineAsmSymbol('LT..'+ReplaceForbiddenAsmSymbolChars(def.mangledname),AB_LOCAL,AT_ADDR,voidpointertype);
|
||||
current_asmdata.asmlists[al_procedures].insertbefore(tai_symbol.create(procendsymbol,0),def.procendtai);
|
||||
end;
|
||||
|
||||
|
||||
@ -3788,12 +3788,12 @@ implementation
|
||||
new_section(list,sec_code,wrappername,target_info.alignment.procalign);
|
||||
if global then
|
||||
begin
|
||||
sym:=current_asmdata.DefineAsmSymbol(wrappername,AB_GLOBAL,AT_FUNCTION);
|
||||
sym:=current_asmdata.DefineAsmSymbol(wrappername,AB_GLOBAL,AT_FUNCTION,procdef);
|
||||
list.concat(Tai_symbol.Create_global(sym,0));
|
||||
end
|
||||
else
|
||||
begin
|
||||
sym:=current_asmdata.DefineAsmSymbol(wrappername,AB_LOCAL,AT_FUNCTION);
|
||||
sym:=current_asmdata.DefineAsmSymbol(wrappername,AB_LOCAL,AT_FUNCTION,procdef);
|
||||
list.concat(Tai_symbol.Create(sym,0));
|
||||
end;
|
||||
a_jmp_external_name(list,externalname);
|
||||
@ -4464,9 +4464,9 @@ implementation
|
||||
for msdos target with -CX option for instance }
|
||||
(create_smartlink_library and not is_nested_pd(current_procinfo.procdef)) or
|
||||
(po_global in current_procinfo.procdef.procoptions) then
|
||||
list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0))
|
||||
list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0,current_procinfo.procdef))
|
||||
else
|
||||
list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0));
|
||||
list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0,current_procinfo.procdef));
|
||||
if assigned(previtem) and
|
||||
(target_info.system in systems_darwin) then
|
||||
list.concat(tai_directive.create(asd_reference,previtem.str));
|
||||
|
||||
@ -393,9 +393,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
|
||||
@ -598,9 +598,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
|
||||
@ -43,7 +43,8 @@ implementation
|
||||
uses
|
||||
sysutils,cutils,
|
||||
globtype,globals,cpuinfo,
|
||||
aasmbase,aasmdata,aasmtai;
|
||||
aasmbase,aasmdata,aasmtai,
|
||||
symdef;
|
||||
|
||||
|
||||
class procedure ti8086nodeutils.InsertMemorySizes;
|
||||
@ -64,7 +65,7 @@ implementation
|
||||
begin
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_stack,'__stack', 16);
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stack', AT_DATA, stacksize));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stack', AT_DATA, stacksize, carraydef.getreusable(u8inttype,stacksize)));
|
||||
{ HACK: since tai_datablock's size parameter is aint, which cannot be
|
||||
larger than 32767 on i8086, but we'd like to support stack size of
|
||||
up to 64kb, we may need to use several tai_datablocks to reserve
|
||||
@ -74,11 +75,11 @@ implementation
|
||||
while stacksizeleft>0 do
|
||||
begin
|
||||
stackblock:=min(stacksizeleft,high(aint));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock,carraydef.getreusable(u8inttype,stackblock)));
|
||||
dec(stacksizeleft,stackblock);
|
||||
inc(i);
|
||||
end;
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stacktop',AT_DATA,0));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stacktop',AT_DATA,0,voidtype));
|
||||
end;
|
||||
|
||||
|
||||
@ -89,7 +90,7 @@ implementation
|
||||
begin
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_heap,'__heap', 16);
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___heap', AT_DATA, heapsize));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___heap', AT_DATA, heapsize,carraydef.getreusable(u8inttype,heapsize)));
|
||||
{ HACK: since tai_datablock's size parameter is aint, which cannot be
|
||||
larger than 32767 on i8086, but we'd like to support heap size of
|
||||
up to 640kb, we may need to use several tai_datablocks to reserve
|
||||
@ -99,11 +100,11 @@ implementation
|
||||
while heapsizeleft>0 do
|
||||
begin
|
||||
heapblock:=min(heapsizeleft,high(aint));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock,carraydef.getreusable(u8inttype,heapblock)));
|
||||
dec(heapsizeleft,heapblock);
|
||||
inc(i);
|
||||
end;
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___heaptop',AT_DATA,0));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___heaptop',AT_DATA,0,voidtype));
|
||||
end;
|
||||
|
||||
|
||||
@ -117,7 +118,7 @@ implementation
|
||||
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'__fpc_stackplusmaxheap_in_para',sizeof(pint));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__fpc_stackplusmaxheap_in_para',AT_DATA,4));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__fpc_stackplusmaxheap_in_para',AT_DATA,4,u32inttype));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_16bit(min($1000,stacksize_para+maxheapsize_para)));
|
||||
end;
|
||||
|
||||
|
||||
@ -251,7 +251,7 @@ uses
|
||||
inherited Create;
|
||||
typ:=ait_llvmalias;
|
||||
oldsym:=_oldsym;
|
||||
newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION);
|
||||
newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION,_def);
|
||||
newsym.declared:=true;
|
||||
def:=_def;
|
||||
bind:=_bind;
|
||||
|
||||
@ -1241,9 +1241,9 @@ implementation
|
||||
refer to the symbol and get the binding correct }
|
||||
if (cs_profile in current_settings.moduleswitches) or
|
||||
(po_global in current_procinfo.procdef.procoptions) then
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION)
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION,current_procinfo.procdef)
|
||||
else
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION);
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION,current_procinfo.procdef);
|
||||
while assigned(item) do
|
||||
begin
|
||||
if mangledname<>item.Str then
|
||||
|
||||
@ -197,7 +197,7 @@ unit llvmpara;
|
||||
paralocnr:=0;
|
||||
repeat
|
||||
paraloc^.llvmloc.loc:=LOC_REFERENCE;
|
||||
paraloc^.llvmloc.sym:=current_asmdata.DefineAsmSymbol(llvmparaname(hp,paralocnr),AB_TEMP,AT_DATA);
|
||||
paraloc^.llvmloc.sym:=current_asmdata.DefineAsmSymbol(llvmparaname(hp,paralocnr),AB_TEMP,AT_DATA,paraloc^.def);
|
||||
{ byval: a pointer to a type that should actually be passed by
|
||||
value (e.g. a record that should be passed on the stack) }
|
||||
paraloc^.llvmvalueloc:=
|
||||
|
||||
@ -57,9 +57,9 @@ implementation
|
||||
tcb: ttai_typedconstbuilder;
|
||||
begin
|
||||
if sym.globalasmsym then
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_GLOBAL,AT_DATA)
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_GLOBAL,AT_DATA,sym.vardef)
|
||||
else
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_LOCAL,AT_DATA);
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_LOCAL,AT_DATA,sym.vardef);
|
||||
if not(vo_is_thread_var in sym.varoptions) then
|
||||
list.concat(taillvmdecl.createdef(asmsym,sym.vardef,nil,sec_data,varalign))
|
||||
else if tf_section_threadvars in target_info.flags then
|
||||
@ -68,7 +68,7 @@ implementation
|
||||
list.concat(taillvmdecl.createdef(asmsym,
|
||||
get_threadvar_record(sym.vardef,field1,field2),
|
||||
nil,sec_data,varalign));
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA,cpointerdef.getreusable(sym.vardef));
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
|
||||
tcb.emit_tai(Tai_const.Create_sym_offset(asmsym,0),cpointerdef.getreusable(sym.vardef));
|
||||
list.concatlist(tcb.get_final_asmlist(
|
||||
|
||||
@ -170,9 +170,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
|
||||
@ -202,9 +202,9 @@ implementation
|
||||
make_global := True;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname, AT_FUNCTION, 0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname, AT_FUNCTION, 0, procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname, AT_FUNCTION, 0));
|
||||
List.concat(Tai_symbol.Createname(labelname, AT_FUNCTION, 0, procdef));
|
||||
|
||||
IsVirtual:=(po_virtualmethod in procdef.procoptions) and
|
||||
not is_objectpascal_helper(procdef.struct);
|
||||
|
||||
@ -576,7 +576,7 @@ implementation
|
||||
current_module.localsymtable.insert(calldescsym);
|
||||
current_asmdata.AsmLists[al_typedconsts].concatList(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(calldescsym.mangledname,AB_GLOBAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol(calldescsym.mangledname,AB_GLOBAL,AT_DATA,calldescsym.vardef),
|
||||
calldescsym.vardef,sec_rodata_norel,
|
||||
lower(calldescsym.mangledname),sizeof(pint)
|
||||
)
|
||||
|
||||
@ -955,7 +955,7 @@ implementation
|
||||
if not is_interface(tprocdef(procdefinition)._class) then
|
||||
begin
|
||||
inc(current_asmdata.NextVTEntryNr);
|
||||
current_asmdata.CurrAsmList.Concat(tai_symbol.CreateName('VTREF'+tostr(current_asmdata.NextVTEntryNr)+'_'+tprocdef(procdefinition).struct.vmt_mangledname+'$$'+tostr(vmtoffset div sizeof(pint)),AT_FUNCTION,0));
|
||||
current_asmdata.CurrAsmList.Concat(tai_symbol.CreateName('VTREF'+tostr(current_asmdata.NextVTEntryNr)+'_'+tprocdef(procdefinition).struct.vmt_mangledname+'$$'+tostr(vmtoffset div sizeof(pint)),AT_FUNCTION,0,voidpointerdef));
|
||||
end;
|
||||
{$endif vtentry}
|
||||
|
||||
|
||||
@ -549,7 +549,7 @@ implementation
|
||||
if not is_interface(procdef.struct) then
|
||||
begin
|
||||
inc(current_asmdata.NextVTEntryNr);
|
||||
current_asmdata.CurrAsmList.Concat(tai_symbol.CreateName('VTREF'+tostr(current_asmdata.NextVTEntryNr)+'_'+procdef._class.vmt_mangledname+'$$'+tostr(vmtoffset div sizeof(pint)),AT_FUNCTION,0));
|
||||
current_asmdata.CurrAsmList.Concat(tai_symbol.CreateName('VTREF'+tostr(current_asmdata.NextVTEntryNr)+'_'+procdef._class.vmt_mangledname+'$$'+tostr(vmtoffset div sizeof(pint)),AT_FUNCTION,0,voidpointerdef));
|
||||
end;
|
||||
{$endif vtentry}
|
||||
if (left.resultdef.typ=objectdef) and
|
||||
|
||||
@ -1274,6 +1274,7 @@ implementation
|
||||
r:single; {Must be real type because of integer overflow risk.}
|
||||
tcb: ttai_typedconstbuilder;
|
||||
sym_count: integer;
|
||||
tabledef: tdef;
|
||||
begin
|
||||
|
||||
{Decide wether a lookup array is size efficient.}
|
||||
@ -1310,7 +1311,6 @@ implementation
|
||||
end;
|
||||
{ write rtti data; make sure that the alignment matches the corresponding data structure
|
||||
in the code that uses it (if alignment is required). }
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_o2s',AB_GLOBAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
{ use TConstPtrUInt packrecords to ensure good alignment }
|
||||
tcb.begin_anonymous_record('',defaultpacking,reqalign,
|
||||
@ -1365,14 +1365,16 @@ implementation
|
||||
end;
|
||||
tcb.end_anonymous_record;
|
||||
|
||||
tabledef:=tcb.end_anonymous_record;
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_o2s',AB_GLOBAL,AT_DATA,tabledef);
|
||||
current_asmdata.asmlists[al_rtti].concatlist(tcb.get_final_asmlist(
|
||||
rttilab,tcb.end_anonymous_record,sec_rodata,
|
||||
rttilab,tabledef,sec_rodata,
|
||||
rttilab.name,const_align(sizeof(pint))));
|
||||
tcb.free;
|
||||
|
||||
{ write indirect symbol }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_o2s',AB_INDIRECT,AT_DATA);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_o2s',AB_INDIRECT,AT_DATA,cpointerdef.getreusable(tabledef));
|
||||
tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
|
||||
current_asmdata.AsmLists[al_rtti].concatList(
|
||||
tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
|
||||
@ -1390,9 +1392,9 @@ implementation
|
||||
rttilab,
|
||||
rttilabind : Tasmsymbol;
|
||||
i:longint;
|
||||
tabledef: tdef;
|
||||
begin
|
||||
{ write rtti data }
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_s2o',AB_GLOBAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
{ begin of Tstring_to_ord }
|
||||
tcb.begin_anonymous_record('',defaultpacking,reqalign,
|
||||
@ -1417,13 +1419,15 @@ implementation
|
||||
tcb.queue_emit_asmsym(mainrtti,rttidef);
|
||||
end;
|
||||
tcb.end_anonymous_record;
|
||||
tabledef:=tcb.end_anonymous_record;
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_s2o',AB_GLOBAL,AT_DATA,tabledef);
|
||||
current_asmdata.asmlists[al_rtti].concatlist(tcb.get_final_asmlist(
|
||||
rttilab,tcb.end_anonymous_record,sec_rodata,
|
||||
rttilab,tabledef,sec_rodata,
|
||||
rttilab.name,const_align(sizeof(pint))));
|
||||
tcb.free;
|
||||
{ write indirect symbol }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_s2o',AB_INDIRECT,AT_DATA);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_s2o',AB_INDIRECT,AT_DATA,cpointerdef.getreusable(tabledef));
|
||||
tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
|
||||
current_asmdata.AsmLists[al_rtti].concatList(
|
||||
tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
|
||||
@ -1559,21 +1563,21 @@ implementation
|
||||
write_child_rtti_data(def,rt);
|
||||
{ write rtti data }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(tstoreddef(def).rtti_mangledname(rt),AB_GLOBAL,AT_DATA);
|
||||
tcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itp_rttidef]+rttilab.Name,
|
||||
internaltypeprefixName[itp_rttidef]+tstoreddef(def).rtti_mangledname(rt),
|
||||
defaultpacking,reqalign,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign
|
||||
);
|
||||
write_rtti_data(tcb,def,rt);
|
||||
rttidef:=tcb.end_anonymous_record;
|
||||
rttilab:=current_asmdata.DefineAsmSymbol(tstoreddef(def).rtti_mangledname(rt),AB_GLOBAL,AT_DATA,rttidef);
|
||||
current_asmdata.AsmLists[al_rtti].concatList(
|
||||
tcb.get_final_asmlist(rttilab,rttidef,sec_rodata,rttilab.name,const_align(sizeof(pint))));
|
||||
tcb.free;
|
||||
{ write indirect symbol }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(tstoreddef(def).rtti_mangledname(rt),AB_INDIRECT,AT_DATA);
|
||||
rttilabind:=current_asmdata.DefineAsmSymbol(tstoreddef(def).rtti_mangledname(rt),AB_INDIRECT,AT_DATA,cpointerdef.getreusable(rttidef));
|
||||
tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
|
||||
current_asmdata.AsmLists[al_rtti].concatList(
|
||||
tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
|
||||
|
||||
@ -1381,9 +1381,9 @@ implementation
|
||||
erroneous code (at least for targets using GOT) }
|
||||
if (cs_profile in current_settings.moduleswitches) or
|
||||
(po_global in current_procinfo.procdef.procoptions) then
|
||||
current_asmdata.DefineAsmSymbol(item.str,AB_GLOBAL,AT_FUNCTION)
|
||||
current_asmdata.DefineAsmSymbol(item.str,AB_GLOBAL,AT_FUNCTION,pd)
|
||||
else
|
||||
current_asmdata.DefineAsmSymbol(item.str,AB_LOCAL,AT_FUNCTION);
|
||||
current_asmdata.DefineAsmSymbol(item.str,AB_LOCAL,AT_FUNCTION,pd);
|
||||
item := TCmdStrListItem(item.next);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -909,7 +909,7 @@ implementation
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
tcb.emit_guid_const(_class.iidguid^);
|
||||
list.concatlist(tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,rec_tguid),
|
||||
rec_tguid,
|
||||
sec_rodata,
|
||||
s,
|
||||
@ -920,7 +920,7 @@ implementation
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||
def:=tcb.emit_shortstring_const(_class.iidstr^);
|
||||
list.concatlist(tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,def),
|
||||
def,
|
||||
sec_rodata,
|
||||
s,
|
||||
@ -1017,7 +1017,7 @@ implementation
|
||||
tcb.emit_tai(Tai_const.Createname(procname,AT_FUNCTION,0),cprocvardef.getreusableprocaddr(vmtpd));
|
||||
{$ifdef vtentry}
|
||||
hs:='VTENTRY'+'_'+_class.vmt_mangledname+'$$'+tostr(_class.vmtmethodoffset(i) div sizeof(pint));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0,voidpointerdef));
|
||||
{$endif vtentry}
|
||||
end;
|
||||
end;
|
||||
@ -1202,7 +1202,7 @@ implementation
|
||||
{ concatenate the VMT to the asmlist }
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(_class.vmt_mangledname,AB_GLOBAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol(_class.vmt_mangledname,AB_GLOBAL,AT_DATA,vmtdef),
|
||||
vmtdef,sec_rodata,_class.vmt_mangledname,const_align(sizeof(pint))
|
||||
)
|
||||
);
|
||||
@ -1214,7 +1214,7 @@ implementation
|
||||
hs:=hs+_class.childof.vmt_mangledname
|
||||
else
|
||||
hs:=hs+_class.vmt_mangledname;
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0,voidpointerdef));
|
||||
{$endif vtentry}
|
||||
symtablestack.pop(current_module.localsymtable);
|
||||
|
||||
@ -1224,8 +1224,8 @@ implementation
|
||||
tcb.emit_tai(Tai_const.Createname(hs,AT_DATA,0),voidpointertype);
|
||||
current_asmdata.AsmLists[al_globals].concatList(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(hs,AB_INDIRECT,AT_DATA),
|
||||
voidpointertype,sec_rodata,hs,const_align(sizeof(pint))));
|
||||
current_asmdata.DefineAsmSymbol(hs,AB_INDIRECT,AT_DATA,cpointerdef.getreusable(vmtdef)),
|
||||
cpointerdef.getreusable(vmtdef),sec_rodata,hs,const_align(sizeof(pint))));
|
||||
tcb.free;
|
||||
end;
|
||||
|
||||
|
||||
@ -730,19 +730,18 @@ implementation
|
||||
(cs_debuginfo in current_settings.moduleswitches) and
|
||||
not assigned(current_asmdata.GetAsmSymbol(sym.name)) then
|
||||
begin
|
||||
list.concat(tai_symbol.Create(current_asmdata.DefineAsmSymbol(sym.name,AB_LOCAL,AT_DATA),0));
|
||||
list.concat(tai_symbol.Create(current_asmdata.DefineAsmSymbol(sym.name,AB_LOCAL,AT_DATA,sym.vardef),0));
|
||||
list.concat(tai_directive.Create(asd_reference,sym.name));
|
||||
end;
|
||||
list.concat(Tai_datablock.create_global(sym.mangledname,size));
|
||||
list.concat(Tai_datablock.create_global(sym.mangledname,size,sym.vardef));
|
||||
end
|
||||
else
|
||||
list.concat(Tai_datablock.create(sym.mangledname,size));
|
||||
|
||||
list.concat(Tai_datablock.create(sym.mangledname,size,sym.vardef));
|
||||
if (tf_supports_packages in target_info.flags) then
|
||||
begin
|
||||
{ add the indirect symbol if needed }
|
||||
new_section(list,sec_rodata,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA,cpointerdef.getreusable(sym.vardef));
|
||||
list.concat(Tai_symbol.Create_Global(symind,0));
|
||||
list.concat(Tai_const.Createname(sym.mangledname,AT_DATA,0));
|
||||
list.concat(tai_symbol_end.Create(symind));
|
||||
@ -855,6 +854,7 @@ implementation
|
||||
count : aint;
|
||||
tablecountplaceholder: ttypedconstplaceholder;
|
||||
nameinit,namefini : TSymStr;
|
||||
tabledef: tdef;
|
||||
|
||||
procedure write_struct_inits(u: tmodule);
|
||||
var
|
||||
@ -1002,10 +1002,11 @@ implementation
|
||||
tablecountplaceholder.free;
|
||||
{ Add to data segment }
|
||||
|
||||
tabledef:=unitinits.end_anonymous_record;
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
unitinits.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol('INITFINAL',AB_GLOBAL,AT_DATA),
|
||||
unitinits.end_anonymous_record,
|
||||
current_asmdata.DefineAsmSymbol('INITFINAL',AB_GLOBAL,AT_DATA,tabledef),
|
||||
tabledef,
|
||||
sec_data,'INITFINAL',sizeof(pint)
|
||||
)
|
||||
);
|
||||
@ -1021,6 +1022,7 @@ implementation
|
||||
count: longint;
|
||||
sym: tasmsymbol;
|
||||
placeholder: ttypedconstplaceholder;
|
||||
tabledef: tdef;
|
||||
begin
|
||||
if (tf_section_threadvars in target_info.flags) then
|
||||
exit;
|
||||
@ -1058,10 +1060,11 @@ implementation
|
||||
placeholder.replace(tai_const.Create_32bit(count),u32inttype);
|
||||
placeholder.free;
|
||||
{ insert in data segment }
|
||||
sym:=current_asmdata.DefineAsmSymbol('FPC_THREADVARTABLES',AB_GLOBAL,AT_DATA);
|
||||
tabledef:=tcb.end_anonymous_record;
|
||||
sym:=current_asmdata.DefineAsmSymbol('FPC_THREADVARTABLES',AB_GLOBAL,AT_DATA,tabledef);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(
|
||||
sym,tcb.end_anonymous_record,sec_data,'FPC_THREADVARTABLES',sizeof(pint)
|
||||
sym,tabledef,sec_data,'FPC_THREADVARTABLES',sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
@ -1115,7 +1118,7 @@ implementation
|
||||
if add then
|
||||
begin
|
||||
s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
|
||||
sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,tabledef);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,tabledef,sec_data,s,sizeof(pint)));
|
||||
current_module.flags:=current_module.flags or uf_threadvars;
|
||||
@ -1127,10 +1130,10 @@ implementation
|
||||
begin
|
||||
{ write indirect symbol }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
|
||||
sym:=current_asmdata.DefineAsmSymbol(s,AB_INDIRECT,AT_DATA);
|
||||
tcb.emit_tai(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(s,AT_DATA,false)),voidpointertype);
|
||||
tcb.emit_tai(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(s,AT_DATA,false)),cpointerdef.getreusable(tabledef));
|
||||
sym:=current_asmdata.DefineAsmSymbol(s,AB_INDIRECT,AT_DATA,voidpointertype);
|
||||
current_asmdata.AsmLists[al_globals].concatList(
|
||||
tcb.get_final_asmlist(sym,voidpointertype,sec_rodata,sym.name,const_align(sizeof(pint))));
|
||||
tcb.get_final_asmlist(sym,cpointerdef.getreusable(tabledef),sec_rodata,sym.name,const_align(sizeof(pint))));
|
||||
tcb.free;
|
||||
end;
|
||||
end;
|
||||
@ -1141,6 +1144,7 @@ implementation
|
||||
hp: tused_unit;
|
||||
tcb: ttai_typedconstbuilder;
|
||||
countplaceholder: ttypedconstplaceholder;
|
||||
tabledef: tdef;
|
||||
count: longint;
|
||||
begin
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
|
||||
@ -1175,10 +1179,11 @@ implementation
|
||||
countplaceholder.replace(Tai_const.Create_pint(count),ptruinttype);
|
||||
countplaceholder.free;
|
||||
{ insert in data segment }
|
||||
tabledef:=tcb.end_anonymous_record;
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(tablename,AB_GLOBAL,AT_DATA),
|
||||
tcb.end_anonymous_record,
|
||||
current_asmdata.DefineAsmSymbol(tablename,AB_GLOBAL,AT_DATA,tabledef),
|
||||
tabledef,
|
||||
sec_data,tablename,sizeof(pint)
|
||||
)
|
||||
);
|
||||
@ -1197,7 +1202,9 @@ implementation
|
||||
s:=make_mangledname(prefix,current_module.localsymtable,'');
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_data,s,sizeof(pint));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0));
|
||||
{ TODO: def of the symbol to be fixed when this is converted to to the
|
||||
typed constant builder }
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0,voidpointertype));
|
||||
repeat
|
||||
{ optimize away unused local/static symbols }
|
||||
if (item.sym.refs>0) or (item.sym.owner.symtabletype=globalsymtable) then
|
||||
@ -1246,6 +1253,7 @@ implementation
|
||||
count : longint;
|
||||
tcb : ttai_typedconstbuilder;
|
||||
countplaceholder : ttypedconstplaceholder;
|
||||
tabledef: tdef;
|
||||
begin
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
|
||||
count:=0;
|
||||
@ -1274,10 +1282,11 @@ implementation
|
||||
countplaceholder.replace(Tai_const.Create_pint(count),ptruinttype);
|
||||
countplaceholder.free;
|
||||
{ Add to data segment }
|
||||
tabledef:=tcb.end_anonymous_record;
|
||||
current_asmdata.AsmLists[al_globals].concatList(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol('FPC_RESOURCESTRINGTABLES',AB_GLOBAL,AT_DATA),
|
||||
tcb.end_anonymous_record,sec_rodata,'FPC_RESOURCESTRINGTABLES',sizeof(pint)
|
||||
current_asmdata.DefineAsmSymbol('FPC_RESOURCESTRINGTABLES',AB_GLOBAL,AT_DATA,tabledef),
|
||||
tabledef,sec_rodata,'FPC_RESOURCESTRINGTABLES',sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
@ -1302,7 +1311,7 @@ implementation
|
||||
tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
|
||||
current_asmdata.asmlists[al_globals].concatList(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol('FPC_RESLOCATION',AB_GLOBAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol('FPC_RESLOCATION',AB_GLOBAL,AT_DATA,voidpointertype),
|
||||
voidpointertype,
|
||||
sec_rodata,
|
||||
'FPC_RESLOCATION',
|
||||
@ -1330,7 +1339,7 @@ implementation
|
||||
tcb.maybe_begin_aggregate(def);
|
||||
tcb.emit_tai(Tai_string.Create(s),def);
|
||||
tcb.maybe_end_aggregate(def);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__fpc_ident',AB_LOCAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__fpc_ident',AB_LOCAL,AT_DATA,def);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,def,sec_fpc,'version',const_align(32))
|
||||
);
|
||||
@ -1342,7 +1351,7 @@ implementation
|
||||
{ stacksize can be specified and is now simulated }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||
tcb.emit_tai(Tai_const.Create_pint(stacksize),ptruinttype);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__stklen',AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__stklen',AB_GLOBAL,AT_DATA,ptruinttype);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__stklen',sizeof(pint))
|
||||
);
|
||||
@ -1362,7 +1371,7 @@ implementation
|
||||
tcb.maybe_begin_aggregate(def);
|
||||
tcb.emit_tai(Tai_string.Create(s),def);
|
||||
tcb.maybe_end_aggregate(def);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__stack_cookie',AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__stack_cookie',AB_GLOBAL,AT_DATA,def);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,def,sec_data,'__stack_cookie',sizeof(pint))
|
||||
);
|
||||
@ -1372,7 +1381,7 @@ implementation
|
||||
{ Initial heapsize }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||
tcb.emit_tai(Tai_const.Create_pint(heapsize),ptruinttype);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__heapsize',AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__heapsize',AB_GLOBAL,AT_DATA,ptruinttype);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__heapsize',sizeof(pint))
|
||||
);
|
||||
@ -1386,13 +1395,13 @@ implementation
|
||||
is separate in the builder }
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_bss,'__fpc_initialheap',current_settings.alignment.varalignmax);
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize,carraydef.getreusable(u8inttype,heapsize)));
|
||||
end;
|
||||
|
||||
{ Valgrind usage }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||
tcb.emit_ord_const(byte(cs_gdb_valgrind in current_settings.globalswitches),u8inttype);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__fpc_valgrind',AB_GLOBAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('__fpc_valgrind',AB_GLOBAL,AT_DATA,u8inttype);
|
||||
current_asmdata.asmlists[al_globals].concatlist(
|
||||
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__fpc_valgrind',sizeof(pint))
|
||||
);
|
||||
|
||||
@ -1089,10 +1089,10 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
(cs_debuginfo in current_settings.moduleswitches) and
|
||||
not assigned(current_asmdata.GetAsmSymbol(fsym.name)) then
|
||||
addstabx:=true;
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(fsym.mangledname,AB_GLOBAL,AT_DATA)
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(fsym.mangledname,AB_GLOBAL,AT_DATA,tcsym.vardef)
|
||||
end
|
||||
else
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(fsym.mangledname,AB_LOCAL,AT_DATA);
|
||||
asmsym:=current_asmdata.DefineAsmSymbol(fsym.mangledname,AB_LOCAL,AT_DATA,tcsym.vardef);
|
||||
if vo_has_section in fsym.varoptions then
|
||||
begin
|
||||
sec:=sec_user;
|
||||
@ -1114,7 +1114,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
begin
|
||||
{ see same code in ncgutil.insertbssdata }
|
||||
reslist.insert(tai_directive.Create(asd_reference,fsym.name));
|
||||
reslist.insert(tai_symbol.Create(current_asmdata.DefineAsmSymbol(fsym.name,AB_LOCAL,AT_DATA),0));
|
||||
reslist.insert(tai_symbol.Create(current_asmdata.DefineAsmSymbol(fsym.name,AB_LOCAL,AT_DATA,tcsym.vardef),0));
|
||||
end;
|
||||
datalist:=fdatalist;
|
||||
end;
|
||||
|
||||
@ -300,6 +300,7 @@ procedure tobjcrttiwriter.gen_objc_methods(list: tasmlist; objccls: tobjectdef;
|
||||
mcnt : integer;
|
||||
mtype : tdef;
|
||||
tcb : ttai_typedconstbuilder;
|
||||
mdef : tdef;
|
||||
begin
|
||||
methodslabel:=nil;
|
||||
mcnt:=0;
|
||||
@ -320,15 +321,6 @@ procedure tobjcrttiwriter.gen_objc_methods(list: tasmlist; objccls: tobjectdef;
|
||||
if mcnt=0 then
|
||||
exit;
|
||||
|
||||
if iscategory then
|
||||
begin
|
||||
methodslabel:=current_asmdata.DefineAsmSymbol('l_OBJC_$_CATEGORY_'+instclsName[classmethods]+'_METHODS_'+objccls.objextname^+'_$_'+objccls.childof.objextname^,AB_LOCAL,AT_DATA);
|
||||
end
|
||||
else
|
||||
begin
|
||||
methodslabel:=current_asmdata.DefineAsmSymbol('l_OBJC_$_'+instclsName[classmethods]+'_METHODS_'+objccls.objextname^,AB_LOCAL,AT_DATA);
|
||||
end;
|
||||
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(internaltypeprefixName[itp_objc_method_list]+tostr(mcnt),
|
||||
C_alignment,1,
|
||||
@ -358,8 +350,18 @@ procedure tobjcrttiwriter.gen_objc_methods(list: tasmlist; objccls: tobjectdef;
|
||||
tcb.queue_init(voidcodepointertype);
|
||||
tcb.queue_emit_proc(defs[i].def);
|
||||
end;
|
||||
|
||||
mdef:=tcb.end_anonymous_record;
|
||||
if iscategory then
|
||||
begin
|
||||
methodslabel:=current_asmdata.DefineAsmSymbol('l_OBJC_$_CATEGORY_'+instclsName[classmethods]+'_METHODS_'+objccls.objextname^+'_$_'+objccls.childof.objextname^,AB_LOCAL,AT_DATA,mdef);
|
||||
end
|
||||
else
|
||||
begin
|
||||
methodslabel:=current_asmdata.DefineAsmSymbol('l_OBJC_$_'+instclsName[classmethods]+'_METHODS_'+objccls.objextname^,AB_LOCAL,AT_DATA,mdef);
|
||||
end;
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(methodslabel,tcb.end_anonymous_record,
|
||||
tcb.get_final_asmlist(methodslabel,mdef,
|
||||
SectType[iscategory,classmethods],
|
||||
SectName[iscategory,classmethods],sizeof(ptrint)
|
||||
)
|
||||
@ -815,7 +817,6 @@ procedure tobjcrttiwriter_fragile.gen_objc_category_sections(list:TAsmList; objc
|
||||
gen_objc_protocol_list(list,objccat.ImplementedInterfaces,protolistsym);
|
||||
|
||||
{ category declaration section }
|
||||
catsym:=current_asmdata.DefineAsmSymbol(objccat.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itb_objc_fr_category],
|
||||
@ -835,6 +836,7 @@ procedure tobjcrttiwriter_fragile.gen_objc_category_sections(list:TAsmList; objc
|
||||
{ properties, not yet supported }
|
||||
tcb.emit_ord_const(0,u32inttype);
|
||||
catdef:=tcb.end_anonymous_record;
|
||||
catsym:=current_asmdata.DefineAsmSymbol(objccat.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA,catdef);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
catsym,catdef,
|
||||
@ -933,7 +935,6 @@ procedure tobjcrttiwriter_fragile.gen_objc_classes_sections(list:TAsmList; objcl
|
||||
{ class declaration section }
|
||||
|
||||
{ 1) meta-class declaration }
|
||||
metasym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcmetartti),AB_LOCAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(internaltypeprefixName[itb_objc_fr_meta_class],
|
||||
C_alignment,1,
|
||||
@ -973,6 +974,7 @@ procedure tobjcrttiwriter_fragile.gen_objc_classes_sections(list:TAsmList; objcl
|
||||
{ From Clang: The class extension is always unused for meta-classes. }
|
||||
tcb.emit_ord_const(0,u32inttype);
|
||||
metaDef:=tcb.end_anonymous_record;
|
||||
metasym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcmetartti),AB_LOCAL,AT_DATA,metadef);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
metasym,metaDef,
|
||||
@ -989,8 +991,6 @@ procedure tobjcrttiwriter_fragile.gen_objc_classes_sections(list:TAsmList; objcl
|
||||
{ generate the instance variables list }
|
||||
gen_objc_ivars(list,objclss,ivarslist);
|
||||
|
||||
clssym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA);
|
||||
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(internaltypeprefixName[itb_objc_fr_class],
|
||||
C_alignment,1,
|
||||
@ -1028,7 +1028,9 @@ procedure tobjcrttiwriter_fragile.gen_objc_classes_sections(list:TAsmList; objcl
|
||||
tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
|
||||
{ TODO: From Clang: weak ivar_layout, necessary for garbage collection support }
|
||||
tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
|
||||
|
||||
clsDef:=tcb.end_anonymous_record;
|
||||
clssym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA,clsDef);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
clssym,clsDef,
|
||||
@ -1059,8 +1061,6 @@ procedure tobjcrttiwriter_fragile.gen_objc_info_sections(list: tasmlist);
|
||||
(catsyms.count<>0) then
|
||||
begin
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
sym := current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'_OBJC_SYMBOLS_$',AB_LOCAL,AT_DATA);
|
||||
|
||||
tcb.begin_anonymous_record('',
|
||||
C_alignment,1,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
@ -1080,6 +1080,7 @@ procedure tobjcrttiwriter_fragile.gen_objc_info_sections(list: tasmlist);
|
||||
for i:=0 to catsyms.count-1 do
|
||||
tcb.emit_tai(Tai_const.Create_sym(tasmsymbol(catsyms[i])),tdef(catrttidefs[i]));
|
||||
symsdef:=tcb.end_anonymous_record;
|
||||
sym := current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'_OBJC_SYMBOLS_$',AB_LOCAL,AT_DATA,symsdef);
|
||||
list.concatList(tcb.get_final_asmlist(sym,
|
||||
symsdef,
|
||||
sec_objc_symbols,'_OBJC_SYMBOLS',
|
||||
@ -1113,6 +1114,7 @@ procedure tobjcrttiwriter_fragile.gen_objc_info_sections(list: tasmlist);
|
||||
list.concatList(tcb.get_final_asmlist(lab,
|
||||
tcb.end_anonymous_record,sec_objc_module_info,'_OBJC_MODULE_INFO',4));
|
||||
|
||||
|
||||
{ Add lazy references to parent classes of all classes defined in this unit }
|
||||
superclasses:=tfpobjectlist.create(false);
|
||||
for i:=0 to classdefs.count-1 do
|
||||
@ -1140,11 +1142,11 @@ procedure tobjcrttiwriter_fragile.gen_objc_info_sections(list: tasmlist);
|
||||
superclasses.free;
|
||||
{ reference symbols for all classes and categories defined in this unit }
|
||||
for i:=0 to classdefs.count-1 do
|
||||
list.concat(tai_symbol.Createname_global_value('.objc_class_name_'+tobjectdef(classdefs[i]).objextname^,AT_DATA,0,0));
|
||||
list.concat(tai_symbol.Createname_global_value('.objc_class_name_'+tobjectdef(classdefs[i]).objextname^,AT_DATA,0,0,voidpointertype));
|
||||
for i:=0 to catdefs.count-1 do
|
||||
list.concat(tai_symbol.Createname_global_value('.objc_category_name_'+
|
||||
tobjectdef(catdefs[i]).childof.objextname^+'_'+
|
||||
tobjectdef(catdefs[i]).objextname^,AT_DATA,0,0));
|
||||
tobjectdef(catdefs[i]).objextname^,AT_DATA,0,0,voidpointertype));
|
||||
end;
|
||||
|
||||
|
||||
@ -1233,7 +1235,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_ivars(list: tasmlist; objccls: tob
|
||||
vis:=AB_PRIVATE_EXTERN
|
||||
else
|
||||
vis:=AB_GLOBAL;
|
||||
vars[vcnt].offssym:=current_asmdata.DefineAsmSymbol(prefix+vf.RealName,vis,AT_DATA);
|
||||
vars[vcnt].offssym:=current_asmdata.DefineAsmSymbol(prefix+vf.RealName,vis,AT_DATA,ptruinttype);
|
||||
tcb.emit_tai(tai_const.create_pint(vf.fieldoffset),ptruinttype);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
@ -1336,10 +1338,10 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_protocol(list: tasmlist; protocol:
|
||||
b) private_extern (should only be merged within the same module)
|
||||
c) weakly defined (so multiple definitions don't cause errors)
|
||||
}
|
||||
lbl:=current_asmdata.DefineAsmSymbol(protocol.rtti_mangledname(objcclassrtti),AB_PRIVATE_EXTERN,AT_DATA);
|
||||
prottype:=search_named_unit_globaltype('OBJC','OBJC_PROTOCOL',true).typedef;
|
||||
lbl:=current_asmdata.DefineAsmSymbol(protocol.rtti_mangledname(objcclassrtti),AB_PRIVATE_EXTERN,AT_DATA,prottype);
|
||||
protocollabel:=lbl;
|
||||
|
||||
prottype:=search_named_unit_globaltype('OBJC','OBJC_PROTOCOL',true).typedef;
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_weak]);
|
||||
tcb.maybe_begin_aggregate(prottype);
|
||||
{ protocol's isa - always nil }
|
||||
@ -1375,7 +1377,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_protocol(list: tasmlist; protocol:
|
||||
|
||||
{ also add an entry to the __DATA, __objc_protolist section, required to
|
||||
register the protocol with the runtime }
|
||||
listsym:=current_asmdata.DefineAsmSymbol(protocol.rtti_mangledname(objcmetartti),AB_PRIVATE_EXTERN,AT_DATA);
|
||||
listsym:=current_asmdata.DefineAsmSymbol(protocol.rtti_mangledname(objcmetartti),AB_PRIVATE_EXTERN,AT_DATA,cpointerdef.getreusable(prottype));
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_weak]);
|
||||
tcb.emit_tai(tai_const.Create_sym(lbl),cpointerdef.getreusable(prottype));
|
||||
list.concatList(
|
||||
@ -1424,7 +1426,6 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_category_sections(list:TAsmList; o
|
||||
gen_objc_protocol_list(list,objccat.ImplementedInterfaces,protolistsym);
|
||||
|
||||
{ category declaration section }
|
||||
catsym:=current_asmdata.DefineAsmSymbol(objccat.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(internaltypeprefixName[itb_objc_nf_category],
|
||||
C_alignment,1,
|
||||
@ -1439,6 +1440,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_category_sections(list:TAsmList; o
|
||||
{ properties, not yet supported }
|
||||
tcb.emit_tai(Tai_const.Create_nil_dataptr,voidpointertype);
|
||||
catdef:=tcb.end_anonymous_record;
|
||||
catsym:=current_asmdata.DefineAsmSymbol(objccat.rtti_mangledname(objcclassrtti),AB_LOCAL,AT_DATA,catdef);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
catsym,catdef,
|
||||
@ -1570,6 +1572,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_class_ro_part(list: tasmlist; objc
|
||||
classStrDef : tdef;
|
||||
classStrSym,
|
||||
ivarslab : TAsmLabel;
|
||||
rodef,
|
||||
class_type : tdef;
|
||||
start,
|
||||
size,
|
||||
@ -1635,8 +1638,6 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_class_ro_part(list: tasmlist; objc
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
|
||||
rosym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(rttitype),AB_LOCAL,AT_DATA);
|
||||
classrolabel:=rosym;
|
||||
tcb.emit_ord_const(flags,u32inttype);
|
||||
tcb.emit_ord_const(start,u32inttype);
|
||||
tcb.emit_ord_const(size,u32inttype);
|
||||
@ -1651,13 +1652,16 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_class_ro_part(list: tasmlist; objc
|
||||
tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
|
||||
{ TODO: properties }
|
||||
tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
|
||||
rodef:=tcb.end_anonymous_record;
|
||||
rosym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(rttitype),AB_LOCAL,AT_DATA,rodef);
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
rosym,tcb.end_anonymous_record,
|
||||
rosym,rodef,
|
||||
sec_objc_const,'_OBJC_META_CLASS',sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
classrolabel:=rosym;
|
||||
end;
|
||||
|
||||
|
||||
@ -1687,7 +1691,8 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
|
||||
rosym : TAsmSymbol;
|
||||
protolistsym : TAsmLabel;
|
||||
vis : TAsmsymbind;
|
||||
tcb : ttai_typedconstbuilder;
|
||||
isatcb,
|
||||
metatcb : ttai_typedconstbuilder;
|
||||
metadef,
|
||||
classdef : tdef;
|
||||
begin
|
||||
@ -1698,8 +1703,25 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
|
||||
vis:=AB_GLOBAL
|
||||
else
|
||||
vis:=AB_PRIVATE_EXTERN;
|
||||
clssym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcclassrtti),vis,AT_DATA);
|
||||
metasym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcmetartti),vis,AT_DATA);
|
||||
|
||||
{ create the typed const builders so we can get the (provisional) types
|
||||
for the class and metaclass symbols }
|
||||
isatcb:=ctai_typedconstbuilder.create([]);
|
||||
classdef:=isatcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itb_objc_nf_class],
|
||||
C_alignment,1,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
|
||||
metatcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
metadef:=metatcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itb_objc_nf_meta_class],
|
||||
C_alignment,1,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
|
||||
clssym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcclassrtti),vis,AT_DATA,classdef);
|
||||
metasym:=current_asmdata.DefineAsmSymbol(objclss.rtti_mangledname(objcmetartti),vis,AT_DATA,metadef);
|
||||
{ 2) the superclass and meta superclass }
|
||||
if assigned(objclss.childof) then
|
||||
begin
|
||||
@ -1730,64 +1752,51 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_classes_sections(list:TAsmList; ob
|
||||
{ B) Class declaration section }
|
||||
{ both class and metaclass are in the objc_data section for obj-c 2 }
|
||||
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
tcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itb_objc_nf_meta_class],
|
||||
C_alignment,1,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
{ 1) meta-class declaration }
|
||||
|
||||
{ the isa }
|
||||
tcb.emit_tai(Tai_const.Create_sym(metaisaSym),voidpointertype);
|
||||
metatcb.emit_tai(Tai_const.Create_sym(metaisaSym),voidpointertype);
|
||||
{ the superclass }
|
||||
tcb.emit_tai(Tai_const.Create_sym(superMetaSym),voidpointertype);
|
||||
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');
|
||||
tcb.emit_tai(Tai_const.Create_sym(ObjCEmptyCacheVar),voidpointertype);
|
||||
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');
|
||||
ConcatSymOrNil(tcb,ObjCEmptyVtableVar,voidpointertype);
|
||||
ConcatSymOrNil(metatcb,ObjCEmptyVtableVar,voidpointertype);
|
||||
{ the read-only part }
|
||||
tcb.emit_tai(Tai_const.Create_sym(metarosym),voidpointertype);
|
||||
metadef:=tcb.end_anonymous_record;
|
||||
metatcb.emit_tai(Tai_const.Create_sym(metarosym),voidpointertype);
|
||||
metatcb.end_anonymous_record;
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
metatcb.get_final_asmlist(
|
||||
metasym,metadef,
|
||||
sec_objc_data,'_OBJC_CLASS',sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
metatcb.free;
|
||||
|
||||
{ 2) regular class declaration }
|
||||
tcb:=ctai_typedconstbuilder.create([]);
|
||||
tcb.begin_anonymous_record(
|
||||
internaltypeprefixName[itb_objc_nf_class],
|
||||
C_alignment,1,
|
||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
|
||||
{ the isa }
|
||||
tcb.emit_tai(Tai_const.Create_sym(metasym),cpointerdef.getreusable(metadef));
|
||||
isatcb.emit_tai(Tai_const.Create_sym(metasym),cpointerdef.getreusable(metadef));
|
||||
{ the superclass }
|
||||
ConcatSymOrNil(tcb,supersym,voidpointertype);
|
||||
ConcatSymOrNil(isatcb,supersym,voidpointertype);
|
||||
{ pointer to cache }
|
||||
tcb.emit_tai(Tai_const.Create_sym(ObjCEmptyCacheVar),voidpointertype);
|
||||
isatcb.emit_tai(Tai_const.Create_sym(ObjCEmptyCacheVar),voidpointertype);
|
||||
{ pointer to vtable }
|
||||
ConcatSymOrNil(tcb,ObjCEmptyVtableVar,voidpointertype);
|
||||
ConcatSymOrNil(isatcb,ObjCEmptyVtableVar,voidpointertype);
|
||||
{ the read-only part }
|
||||
tcb.emit_tai(Tai_const.Create_sym(rosym),voidpointertype);
|
||||
classdef:=tcb.end_anonymous_record;
|
||||
isatcb.emit_tai(Tai_const.Create_sym(rosym),voidpointertype);
|
||||
isatcb.end_anonymous_record;
|
||||
list.concatList(
|
||||
tcb.get_final_asmlist(
|
||||
isatcb.get_final_asmlist(
|
||||
clssym,classdef,
|
||||
sec_objc_data,'_OBJC_CLASS',sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
isatcb.free;
|
||||
|
||||
classlabel:=clssym;
|
||||
classlabeldef:=classdef;;
|
||||
@ -1803,9 +1812,9 @@ procedure tobjcrttiwriter_nonfragile.addclasslist(list: tasmlist; section: tasms
|
||||
begin
|
||||
if classes.count=0 then
|
||||
exit;
|
||||
sym:=current_asmdata.DefineAsmSymbol(symname,AB_LOCAL,AT_DATA);
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||
arrdef:=carraydef.getreusable(voidpointertype,classes.count);
|
||||
sym:=current_asmdata.DefineAsmSymbol(symname,AB_LOCAL,AT_DATA,arrdef);
|
||||
tcb.maybe_begin_aggregate(arrdef);
|
||||
for i:=0 to classes.count-1 do
|
||||
tcb.emit_tai(
|
||||
@ -1906,7 +1915,7 @@ procedure MaybeGenerateObjectiveCImageInfo(globalst, localst: tsymtable);
|
||||
tcb.emit_ord_const(0,u64inttype);
|
||||
current_asmdata.asmlists[al_objc_data].concatList(
|
||||
tcb.get_final_asmlist(
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'_OBJC_IMAGE_INFO',AB_LOCAL,AT_DATA),
|
||||
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'_OBJC_IMAGE_INFO',AB_LOCAL,AT_DATA,u64inttype),
|
||||
u64inttype,sec_objc_image_info,'_OBJC_IMAGE_INFO',sizeof(pint)
|
||||
)
|
||||
);
|
||||
|
||||
@ -1618,11 +1618,11 @@ type
|
||||
if target_info.system in systems_windows then
|
||||
begin
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'_FPCDummy',4);
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.createname_global('_FPCDummy',AT_DATA,0));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.createname_global('_FPCDummy',AT_DATA,0,u32inttype));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_const.create_32bit(0));
|
||||
|
||||
new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
|
||||
current_asmdata.asmlists[al_procedures].concat(tai_symbol.createname_global('_DLLMainCRTStartup',AT_FUNCTION,0));
|
||||
current_asmdata.asmlists[al_procedures].concat(tai_symbol.createname_global('_DLLMainCRTStartup',AT_FUNCTION,0,voidcodepointertype));
|
||||
gen_fpc_dummy(current_asmdata.asmlists[al_procedures]);
|
||||
current_asmdata.asmlists[al_procedures].concat(tai_const.createname('_FPCDummy',0));
|
||||
end;
|
||||
|
||||
@ -52,7 +52,7 @@ Unit rappcgas;
|
||||
{ aasm }
|
||||
cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
{ symtable }
|
||||
symconst,symsym,
|
||||
symconst,symsym,symdef,
|
||||
{ parser }
|
||||
procinfo,
|
||||
rabase,rautils,
|
||||
@ -350,7 +350,7 @@ Unit rappcgas;
|
||||
if (oper.opr.val<>0) then
|
||||
Message(asmr_e_wrong_sym_type);
|
||||
oper.opr.typ:=OPR_SYMBOL;
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION);
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION,voidcodepointertype);
|
||||
end
|
||||
else
|
||||
inc(oper.opr.val,l);
|
||||
@ -765,13 +765,13 @@ Unit rappcgas;
|
||||
Message(asmr_e_syn_operand);
|
||||
if use_dotted_functions and
|
||||
assigned(instr.Operands[1].opr.ref.symbol) then
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION);
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION,voidcodepointertype);
|
||||
end;
|
||||
{ regular name is toc entry, .-based name is actual code }
|
||||
if use_dotted_functions and
|
||||
(instr.Operands[1].opr.typ = OPR_SYMBOL) and
|
||||
(instr.Operands[1].opr.symbol.typ=AT_FUNCTION) then
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION);
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION,voidcodepointertype);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -1858,7 +1858,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.DefineAsmSymbol(symname,AB_GLOBAL, AT_DATA);
|
||||
l:=current_asmdata.DefineAsmSymbol(symname,AB_GLOBAL, AT_METADATA, voidpointertype);
|
||||
new_section(current_asmdata.asmlists[al_picdata],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)));
|
||||
|
||||
@ -54,7 +54,7 @@ uses
|
||||
{ aasm }
|
||||
cpubase, aasmbase, aasmtai,aasmdata, aasmcpu,
|
||||
{ symtable }
|
||||
symconst, symsym,
|
||||
symconst, symsym, symdef,
|
||||
{ parser }
|
||||
procinfo,
|
||||
rabase, rautils,
|
||||
@ -361,7 +361,7 @@ var
|
||||
if (oper.opr.val<>0) then
|
||||
Message(asmr_e_wrong_sym_type);
|
||||
oper.opr.typ:=OPR_SYMBOL;
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION);
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION,voidcodepointertype);
|
||||
end
|
||||
else
|
||||
inc(oper.opr.val,l);
|
||||
@ -767,12 +767,12 @@ begin
|
||||
Message(asmr_e_syn_operand);
|
||||
if use_dotted_functions and
|
||||
assigned(instr.Operands[1].opr.ref.symbol) then
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION);
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION,voidcodepointertype);
|
||||
end;
|
||||
if use_dotted_functions and
|
||||
(instr.Operands[1].opr.typ = OPR_SYMBOL) and
|
||||
(instr.Operands[1].opr.symbol.typ=AT_FUNCTION) then
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION);
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION,voidcodepointertype);
|
||||
end;
|
||||
|
||||
function tppcattreader.is_targetdirective(const s: string): boolean;
|
||||
|
||||
@ -342,13 +342,13 @@ unit cgppc;
|
||||
else
|
||||
stubalign:=16;
|
||||
new_section(current_asmdata.asmlists[al_imports],sec_stub,'',stubalign);
|
||||
result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION);
|
||||
result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION,voidcodepointertype);
|
||||
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.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
|
||||
l1 := current_asmdata.DefineAsmSymbol('L'+s+'$lazy_ptr',AB_LOCAL,AT_DATA);
|
||||
l1 := current_asmdata.DefineAsmSymbol('L'+s+'$lazy_ptr',AB_LOCAL,AT_DATA,voidpointertype);
|
||||
reference_reset_symbol(href,l1,0,sizeof(pint));
|
||||
href.refaddr := addr_higha;
|
||||
if (cs_create_pic in current_settings.moduleswitches) then
|
||||
@ -816,7 +816,7 @@ unit cgppc;
|
||||
begin
|
||||
TPPCAsmData(current_asmdata).DirectTOCEntries:=TPPCAsmData(current_asmdata).DirectTOCEntries+1;
|
||||
new_section(current_asmdata.AsmLists[al_picdata],sec_toc,'',sizeof(pint));
|
||||
ref.symbol:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA);
|
||||
ref.symbol:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA,voidpointertype);
|
||||
current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(ref.symbol,0));
|
||||
{ do not assign the result of these statements to ref.symbol: the
|
||||
access must be done via the LC..symname symbol; these are just
|
||||
@ -847,7 +847,7 @@ unit cgppc;
|
||||
{ base address for this batch of toc table entries that we'll
|
||||
put in a data block instead }
|
||||
new_section(current_asmdata.AsmLists[al_indirectpicdata],sec_rodata,'',sizeof(pint));
|
||||
sym:=current_asmdata.DefineAsmSymbol('tocsubtable'+tostr(tocnr),AB_LOCAL,AT_DATA);
|
||||
sym:=current_asmdata.DefineAsmSymbol('tocsubtable'+tostr(tocnr),AB_LOCAL,AT_DATA,voidpointertype);
|
||||
current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(sym,0));
|
||||
end;
|
||||
{ add the reference to the actual symbol inside the tocsubtable }
|
||||
@ -857,7 +857,7 @@ unit cgppc;
|
||||
current_asmdata.WeakRefAsmSymbol(symname)
|
||||
else
|
||||
current_asmdata.WeakRefAsmSymbol('.'+symname);
|
||||
tocsym:=TTOCAsmSymbol(current_asmdata.DefineAsmSymbolByClass(TTOCAsmSymbol,nlsymname,AB_LOCAL,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));
|
||||
|
||||
@ -163,9 +163,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
|
||||
@ -2225,9 +2225,9 @@ implementation
|
||||
begin
|
||||
if (po_global in pd.procoptions) or
|
||||
(cs_profile in current_settings.moduleswitches) then
|
||||
current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION)
|
||||
current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION,pd)
|
||||
else
|
||||
current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION);
|
||||
current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION,pd);
|
||||
end;
|
||||
|
||||
current_structdef:=old_current_structdef;
|
||||
|
||||
@ -140,7 +140,7 @@ implementation
|
||||
{ add indirect symbol }
|
||||
{ ToDo: do we also need this for the else part? }
|
||||
new_section(list,sec_rodata,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA,cpointerdef.getreusable(sym.vardef));
|
||||
list.concat(Tai_symbol.Create_Global(symind,0));
|
||||
list.concat(Tai_const.Createname(sym.mangledname,AT_DATA,0));
|
||||
list.concat(tai_symbol_end.Create(symind));
|
||||
|
||||
@ -1225,7 +1225,8 @@ unit raatt;
|
||||
commname:=actasmpattern;
|
||||
Consume(AS_ID);
|
||||
Consume(AS_COMMA);
|
||||
curList.concat(Tai_datablock.Create(commname,BuildConstExpression(false,false)));
|
||||
symofs:=BuildConstExpression(false,false);
|
||||
curList.concat(Tai_datablock.Create(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
|
||||
if actasmtoken<>AS_SEPARATOR then
|
||||
Consume(AS_SEPARATOR);
|
||||
end;
|
||||
@ -1236,7 +1237,8 @@ unit raatt;
|
||||
commname:=actasmpattern;
|
||||
Consume(AS_ID);
|
||||
Consume(AS_COMMA);
|
||||
curList.concat(Tai_datablock.Create_global(commname,BuildConstExpression(false,false)));
|
||||
symofs:=BuildConstExpression(false,false);
|
||||
curList.concat(Tai_datablock.Create_global(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
|
||||
if actasmtoken<>AS_SEPARATOR then
|
||||
Consume(AS_SEPARATOR);
|
||||
end;
|
||||
|
||||
@ -1578,7 +1578,7 @@ end;
|
||||
{ linked list of instructions.(used by AT&T styled asm) }
|
||||
{*********************************************************************}
|
||||
begin
|
||||
p.concat(Tai_symbol.Createname_global(s,AT_LABEL,0));
|
||||
p.concat(Tai_symbol.Createname_global(s,AT_LABEL,0,voidcodepointertype));
|
||||
end;
|
||||
|
||||
procedure ConcatLocal(p:TAsmList;const s : string);
|
||||
@ -1588,7 +1588,7 @@ end;
|
||||
{ linked list of instructions. }
|
||||
{*********************************************************************}
|
||||
begin
|
||||
p.concat(Tai_symbol.Createname(s,AT_LABEL,0));
|
||||
p.concat(Tai_symbol.Createname(s,AT_LABEL,0,voidcodepointertype));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -74,9 +74,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
procdef.init_paraloc_info(callerside);
|
||||
|
||||
@ -151,7 +151,7 @@ begin
|
||||
{$ifdef i386}
|
||||
{ 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(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(Tai_symbol_end.Createname(hp2.name^));
|
||||
{$endif i386}
|
||||
|
||||
@ -152,7 +152,7 @@ begin
|
||||
{$ifdef i386}
|
||||
{ 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(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(Tai_symbol_end.Createname(hp2.name^));
|
||||
{$endif i386}
|
||||
|
||||
@ -229,7 +229,7 @@ begin
|
||||
{$ifdef i386}
|
||||
{ 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(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(Tai_symbol_end.Createname(hp2.name^));
|
||||
{$endif i386}
|
||||
|
||||
@ -231,7 +231,7 @@ begin
|
||||
{$ifdef i386}
|
||||
{ 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(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(Tai_symbol_end.Createname(hp2.name^));
|
||||
{$endif i386}
|
||||
|
||||
@ -515,9 +515,9 @@ implementation
|
||||
{ place jump in al_procedures }
|
||||
new_section(current_asmdata.asmlists[al_imports],sec_code,'',0);
|
||||
if ImportSymbol.Name <> '' then
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ImportSymbol.MangledName,AT_FUNCTION,0))
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ImportSymbol.MangledName,AT_FUNCTION,0,voidcodepointertype))
|
||||
else
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ExtractFileName(ImportLibrary.Name)+'_index_'+tostr(ImportSymbol.ordnr),AT_FUNCTION,0));
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ExtractFileName(ImportLibrary.Name)+'_index_'+tostr(ImportSymbol.ordnr),AT_FUNCTION,0,voidcodepointertype));
|
||||
current_asmdata.asmlists[al_imports].concat(tai_function_name.create(''));
|
||||
{$ifdef ARM}
|
||||
reference_reset_symbol(href,l5,0,sizeof(pint));
|
||||
@ -549,7 +549,7 @@ implementation
|
||||
inc(suffix);
|
||||
importname:='__imp_'+ImportSymbol.MangledName+'_'+tostr(suffix);
|
||||
end;
|
||||
current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4));
|
||||
current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4,voidcodepointertype));
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -560,13 +560,13 @@ implementation
|
||||
inc(suffix);
|
||||
importname:='__imp_by_ordinal'+tostr(ImportSymbol.ordnr)+'_'+tostr(suffix);
|
||||
end;
|
||||
current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4));
|
||||
current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4,voidcodepointertype));
|
||||
end;
|
||||
end;
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l4));
|
||||
end
|
||||
else
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ImportSymbol.MangledName,AT_DATA,0));
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ImportSymbol.MangledName,AT_DATA,0,voidpointertype));
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(TAsmLabel(Importlabels[j])));
|
||||
if target_info.system=system_x86_64_win64 then
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
|
||||
@ -788,7 +788,7 @@ implementation
|
||||
new_section(current_asmdata.asmlists[al_exports],sec_edata,'',0);
|
||||
{ create label to reference from main so smartlink will include
|
||||
the .edata section }
|
||||
current_asmdata.asmlists[al_exports].concat(Tai_symbol.Createname_global(make_mangledname('EDATA',current_module.localsymtable,''),AT_DATA,0));
|
||||
current_asmdata.asmlists[al_exports].concat(Tai_symbol.Createname_global(make_mangledname('EDATA',current_module.localsymtable,''),AT_METADATA,0,voidpointertype));
|
||||
{ export flags }
|
||||
current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(0));
|
||||
{ date/time stamp }
|
||||
|
||||
@ -819,7 +819,7 @@ unit cgx86;
|
||||
current_asmdata.asmlists[al_imports]:=TAsmList.create;
|
||||
|
||||
new_section(current_asmdata.asmlists[al_imports],sec_stub,'',0);
|
||||
result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION);
|
||||
result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION,voidcodepointertype);
|
||||
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
|
||||
{ register as a weak symbol if necessary }
|
||||
if weak then
|
||||
|
||||
@ -72,9 +72,9 @@ implementation
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0,procdef));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user