* Xtensa: fix txtensanodeutils.insert_init_final_table for the windowed abi

git-svn-id: trunk@44376 -
This commit is contained in:
florian 2020-03-27 22:14:17 +00:00
parent 523ebb42cf
commit 28154cebd1

View File

@ -33,7 +33,7 @@ interface
type type
tavrnodeutils = class(tnodeutils) txtensanodeutils = class(tnodeutils)
protected protected
class procedure insert_init_final_table(entries:tfplist); override; class procedure insert_init_final_table(entries:tfplist); override;
end; end;
@ -52,7 +52,7 @@ implementation
pass_1; pass_1;
class procedure tavrnodeutils.insert_init_final_table(entries:tfplist); class procedure txtensanodeutils.insert_init_final_table(entries:tfplist);
var var
op : TAsmOp; op : TAsmOp;
initList, finalList, header: TAsmList; initList, finalList, header: TAsmList;
@ -62,39 +62,47 @@ implementation
initList:=TAsmList.create; initList:=TAsmList.create;
finalList:=TAsmList.create; finalList:=TAsmList.create;
for i:=0 to entries.count-1 do for i:=0 to entries.count-1 do
begin begin
entry:=pinitfinalentry(entries[i]); entry:=pinitfinalentry(entries[i]);
if entry^.finifunc<>'' then if entry^.finifunc<>'' then
finalList.Concat(taicpu.op_sym(A_CALL0,current_asmdata.RefAsmSymbol(entry^.finifunc,AT_FUNCTION))); finalList.Concat(taicpu.op_sym(A_CALL0,current_asmdata.RefAsmSymbol(entry^.finifunc,AT_FUNCTION)));
if entry^.initfunc<>'' then if entry^.initfunc<>'' then
initList.Concat(taicpu.op_sym(A_CALL0,current_asmdata.RefAsmSymbol(entry^.initfunc,AT_FUNCTION))); initList.Concat(taicpu.op_sym(A_CALL0,current_asmdata.RefAsmSymbol(entry^.initfunc,AT_FUNCTION)));
end; end;
initList.Concat(taicpu.op_none(A_RET)); case target_info.abi of
finalList.Concat(taicpu.op_none(A_RET)); abi_xtensa_call0:
begin
begin initList.Concat(taicpu.op_none(A_RET));
header:=TAsmList.create; finalList.Concat(taicpu.op_none(A_RET));
new_section(header, sec_code, 'FPC_INIT_FUNC_TABLE', 1); end;
header.concat(tai_symbol.Createname_global('FPC_INIT_FUNC_TABLE',AT_FUNCTION,0,voidcodepointertype)); abi_xtensa_windowed:
begin
initList.insertList(header); initList.Concat(taicpu.op_none(A_RETW));
header.free; finalList.Concat(taicpu.op_none(A_RETW));
end;
current_asmdata.AsmLists[al_procedures].concatList(initList); else
Internalerror(2020031410);
end; end;
begin header:=TAsmList.create;
header:=TAsmList.create; new_section(header, sec_code, 'FPC_INIT_FUNC_TABLE', 1);
new_section(header, sec_code, 'FPC_FINALIZE_FUNC_TABLE', 1); header.concat(tai_symbol.Createname_global('FPC_INIT_FUNC_TABLE',AT_FUNCTION,0,voidcodepointertype));
header.concat(tai_symbol.Createname_global('FPC_FINALIZE_FUNC_TABLE',AT_FUNCTION,0,voidcodepointertype));
finalList.insertList(header); initList.insertList(header);
header.free; header.free;
current_asmdata.AsmLists[al_procedures].concatList(finalList); current_asmdata.AsmLists[al_procedures].concatList(initList);
end;
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,voidcodepointertype));
finalList.insertList(header);
header.free;
current_asmdata.AsmLists[al_procedures].concatList(finalList);
initList.Free; initList.Free;
finalList.Free; finalList.Free;
@ -103,6 +111,6 @@ implementation
end; end;
begin begin
cnodeutils:=tavrnodeutils; cnodeutils:=txtensanodeutils;
end. end.