mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 04:59:26 +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;
|
||||
srsym : tsym;
|
||||
st : tsymtable;
|
||||
objst : tobjectsymtable;
|
||||
curroffset : aint;
|
||||
s,sorg : TIDString;
|
||||
vmtwritten : boolean;
|
||||
@ -1250,8 +1249,6 @@ implementation
|
||||
(oo_has_vmt in def.objectoptions) and
|
||||
(def.vmt_offset<fieldoffset) then
|
||||
begin
|
||||
objst:=tobjectsymtable(def.symtable);
|
||||
objst.alignrecord(def.vmt_offset,sizeof(TConstPtrUInt));
|
||||
for i:=1 to def.vmt_offset-curroffset do
|
||||
list.concat(tai_const.create_8bit(0));
|
||||
list.concat(tai_const.createname(def.vmt_mangledname,0));
|
||||
|
@ -3922,7 +3922,11 @@ implementation
|
||||
tObjectSymtable(symtable).fieldalignment);
|
||||
|
||||
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;
|
||||
tObjectSymtable(symtable).datasize:=
|
||||
|
Loading…
Reference in New Issue
Block a user