mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 20:49:35 +01:00
* don't generate instruction alignment fill bytes in non exectuable sections
git-svn-id: trunk@14251 -
This commit is contained in:
parent
26869de684
commit
4123e0425c
@ -629,7 +629,7 @@ interface
|
||||
constructor Create_zeros(b:byte);
|
||||
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||
function calculatefillbuf(var buf : tfillbuffer):pchar;virtual;
|
||||
function calculatefillbuf(var buf : tfillbuffer;executable : boolean):pchar;virtual;
|
||||
end;
|
||||
tai_align_class = class of tai_align_abstract;
|
||||
|
||||
@ -2350,7 +2350,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function tai_align_abstract.calculatefillbuf(var buf : tfillbuffer):pchar;
|
||||
function tai_align_abstract.calculatefillbuf(var buf : tfillbuffer;executable : boolean):pchar;
|
||||
begin
|
||||
if fillsize>sizeof(buf) then
|
||||
internalerror(200404293);
|
||||
|
||||
@ -1123,17 +1123,20 @@ Implementation
|
||||
lebbuf : array[0..63] of byte;
|
||||
objsym,
|
||||
objsymend : TObjSymbol;
|
||||
zerobuf : array[0..63] of byte;
|
||||
begin
|
||||
fillchar(zerobuf,sizeof(zerobuf),0);
|
||||
{ main loop }
|
||||
while assigned(hp) do
|
||||
begin
|
||||
case hp.typ of
|
||||
ait_align :
|
||||
begin
|
||||
if (oso_data in ObjData.CurrObjSec.secoptions) then
|
||||
ObjData.writebytes(Tai_align_abstract(hp).calculatefillbuf(fillbuffer)^,Tai_align_abstract(hp).fillsize)
|
||||
if oso_data in ObjData.CurrObjSec.secoptions then
|
||||
ObjData.writebytes(Tai_align_abstract(hp).calculatefillbuf(fillbuffer,oso_executable in ObjData.CurrObjSec.secoptions)^,
|
||||
Tai_align_abstract(hp).fillsize)
|
||||
else
|
||||
ObjData.alloc(Tai_align_abstract(hp).fillsize);
|
||||
ObjData.alloc(Tai_align_abstract(hp).fillsize);
|
||||
end;
|
||||
ait_section :
|
||||
begin
|
||||
|
||||
@ -189,7 +189,7 @@ interface
|
||||
reg : tregister;
|
||||
constructor create(b:byte);override;
|
||||
constructor create_op(b: byte; _op: byte);override;
|
||||
function calculatefillbuf(var buf : tfillbuffer):pchar;override;
|
||||
function calculatefillbuf(var buf : tfillbuffer;executable : boolean):pchar;override;
|
||||
end;
|
||||
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
@ -451,7 +451,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function tai_align.calculatefillbuf(var buf : tfillbuffer):pchar;
|
||||
function tai_align.calculatefillbuf(var buf : tfillbuffer;executable : boolean):pchar;
|
||||
const
|
||||
{$ifdef x86_64}
|
||||
alignarray:array[0..3] of string[4]=(
|
||||
@ -474,8 +474,8 @@ implementation
|
||||
j : longint;
|
||||
localsize: byte;
|
||||
begin
|
||||
inherited calculatefillbuf(buf);
|
||||
if not use_op then
|
||||
inherited calculatefillbuf(buf,executable);
|
||||
if not(use_op) and executable then
|
||||
begin
|
||||
bufptr:=pchar(@buf);
|
||||
{ fillsize may still be used afterwards, so don't modify }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user