* If alignment requirement of data is bigger than alignment of the section being written to, increase section alignment to match. This mostly affects cases of non-smart linking, where wrong initial alignment used to cause hard to catch misalignment issues. It also largely obsoletes the need to supply the initial section alignment (hidden tai_section constructor,etc).

* Likewise, when merging object sections into exe sections, set alignment of exe section to maximum value.

git-svn-id: trunk@21964 -
This commit is contained in:
sergei 2012-07-24 08:38:11 +00:00
parent b50d0aa3d0
commit 24c7b7f433
2 changed files with 6 additions and 1 deletions

View File

@ -1107,6 +1107,9 @@ Implementation
short jumps to become out of range }
Tai_align_abstract(hp).fillsize:=Tai_align_abstract(hp).aligntype;
ObjData.alloc(Tai_align_abstract(hp).fillsize);
{ may need to increase alignment of section }
if tai_align_abstract(hp).aligntype>ObjData.CurrObjSec.secalign then
ObjData.CurrObjSec.secalign:=tai_align_abstract(hp).aligntype;
end
else
Tai_align_abstract(hp).fillsize:=0;
@ -1353,6 +1356,8 @@ Implementation
case hp.typ of
ait_align :
begin
if tai_align_abstract(hp).aligntype>ObjData.CurrObjSec.secalign then
InternalError(2012072301);
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)

View File

@ -1443,10 +1443,10 @@ implementation
else
begin
{ inherit section options }
SecAlign:=objsec.SecAlign;
SecOptions:=SecOptions+objsec.SecOptions;
end;
{ relate ObjSection to ExeSection, and mark it Used by default }
SecAlign:=max(objsec.SecAlign,SecAlign);
objsec.ExeSection:=self;
objsec.Used:=true;
end;