* don't generate pdata and xdata if there is neither a relevant prologue nor a handler

This commit is contained in:
Sven/Sarah Barth 2024-11-08 23:27:35 +01:00
parent f2d44148fb
commit b67415d1a8

View File

@ -447,14 +447,21 @@ unit agcpugas;
if inprologue then
cgmessage(asmw_e_missing_endprologue);
{ only generate xdata and pdata if we have any
prologue or a handler is set }
unwinddata:=convert_unwinddata(sehlist);
if unwinddata.size>0 then
begin
writebyte($E4);
{ fill up with NOPs }
while unwinddata.size mod 4<>0 do
writebyte($E3);
end;
if (handlerflags<>0) or (unwinddata.size<>0) then
begin
{ note: we can pass Nil here, because in case of a LLVM
backend this whole code shouldn't be required
anyway }
@ -465,7 +472,7 @@ unit agcpugas;
tmplist.concat(tai_const.Create_rva_sym(lastsym.sym));
tmplist.concat(tai_const.Create_rva_sym(xdatasym));
new_section(tmplist,sec_rodata,xdatasym.name,0);
new_section(tmplist,sec_rodata,xdatasym.name,sizeof(int32));
tmplist.concat(tai_symbol.Create(xdatasym,0));
tmplist.concat(tai_comment.Create(strpnew('instr: '+tostr(instrcount)+', data: '+tostr(datacount)+', unwind: '+tostr(unwinddata.size))));
@ -526,7 +533,6 @@ unit agcpugas;
if cs_asm_source in init_settings.globalswitches then
tmplist.concat(tai_comment.create(strpnew(hexstr(unwindrec,8))));
end;
unwinddata.free;
if handlerflags<>0 then
begin
@ -540,6 +546,9 @@ unit agcpugas;
end;
handlerdata:=nil;
end;
unwinddata.free;
sehlist.free;
sehlist:=nil;