mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:09:30 +02:00
* If object has VMT, properly align whole object instance if target CPU requires alignment. It fixes usage of static object instances created as var or const on CPUs which require alignment.
* Partially reverted Micha's fix in revs 10544,10546,10548, because it is not needed anymore. git-svn-id: trunk@10648 -
This commit is contained in:
parent
4341b18461
commit
348e30958e
@ -1174,7 +1174,6 @@ implementation
|
|||||||
obj : tobjectdef;
|
obj : tobjectdef;
|
||||||
srsym : tsym;
|
srsym : tsym;
|
||||||
st : tsymtable;
|
st : tsymtable;
|
||||||
objst : tobjectsymtable;
|
|
||||||
curroffset : aint;
|
curroffset : aint;
|
||||||
s,sorg : TIDString;
|
s,sorg : TIDString;
|
||||||
vmtwritten : boolean;
|
vmtwritten : boolean;
|
||||||
@ -1250,8 +1249,6 @@ implementation
|
|||||||
(oo_has_vmt in def.objectoptions) and
|
(oo_has_vmt in def.objectoptions) and
|
||||||
(def.vmt_offset<fieldoffset) then
|
(def.vmt_offset<fieldoffset) then
|
||||||
begin
|
begin
|
||||||
objst:=tobjectsymtable(def.symtable);
|
|
||||||
objst.alignrecord(def.vmt_offset,sizeof(TConstPtrUInt));
|
|
||||||
for i:=1 to def.vmt_offset-curroffset do
|
for i:=1 to def.vmt_offset-curroffset do
|
||||||
list.concat(tai_const.create_8bit(0));
|
list.concat(tai_const.create_8bit(0));
|
||||||
list.concat(tai_const.createname(def.vmt_mangledname,0));
|
list.concat(tai_const.createname(def.vmt_mangledname,0));
|
||||||
|
@ -3922,7 +3922,11 @@ implementation
|
|||||||
tObjectSymtable(symtable).fieldalignment);
|
tObjectSymtable(symtable).fieldalignment);
|
||||||
|
|
||||||
if (tf_requires_proper_alignment in target_info.flags) then
|
if (tf_requires_proper_alignment in target_info.flags) then
|
||||||
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
|
begin
|
||||||
|
{ Align VMT pointer and whole object instance if target CPU requires alignment. }
|
||||||
|
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
|
||||||
|
tObjectSymtable(symtable).alignrecord(tObjectSymtable(symtable).datasize,sizeof(pint));
|
||||||
|
end;
|
||||||
|
|
||||||
vmt_offset:=tObjectSymtable(symtable).datasize;
|
vmt_offset:=tObjectSymtable(symtable).datasize;
|
||||||
tObjectSymtable(symtable).datasize:=
|
tObjectSymtable(symtable).datasize:=
|
||||||
|
Loading…
Reference in New Issue
Block a user