* generate the omf alignment based on the value of SecAlign, instead of

duplicating the code from sectiontype2align in the TOmfObjSection constructor

git-svn-id: trunk@30603 -
This commit is contained in:
nickysn 2015-04-15 08:55:19 +00:00
parent d7416afd88
commit c407f61107

View File

@ -61,15 +61,15 @@ interface
private private
FClassName: string; FClassName: string;
FOverlayName: string; FOverlayName: string;
FOmfAlignment: TOmfSegmentAlignment;
FCombination: TOmfSegmentCombination; FCombination: TOmfSegmentCombination;
FUse: TOmfSegmentUse; FUse: TOmfSegmentUse;
FPrimaryGroup: string; FPrimaryGroup: string;
function GetOmfAlignment: TOmfSegmentAlignment;
public public
constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override; constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
property ClassName: string read FClassName; property ClassName: string read FClassName;
property OverlayName: string read FOverlayName; property OverlayName: string read FOverlayName;
property OmfAlignment: TOmfSegmentAlignment read FOmfAlignment; property OmfAlignment: TOmfSegmentAlignment read GetOmfAlignment;
property Combination: TOmfSegmentCombination read FCombination; property Combination: TOmfSegmentCombination read FCombination;
property Use: TOmfSegmentUse read FUse; property Use: TOmfSegmentUse read FUse;
property PrimaryGroup: string read FPrimaryGroup; property PrimaryGroup: string read FPrimaryGroup;
@ -227,6 +227,22 @@ implementation
TOmfObjSection TOmfObjSection
****************************************************************************} ****************************************************************************}
function TOmfObjSection.GetOmfAlignment: TOmfSegmentAlignment;
begin
case SecAlign of
1:
result:=saRelocatableByteAligned;
2:
result:=saRelocatableWordAligned;
4:
result:=saRelocatableDWordAligned;
16:
result:=saRelocatableParaAligned;
else
internalerror(2015041504);
end;
end;
constructor TOmfObjSection.create(AList: TFPHashObjectList; constructor TOmfObjSection.create(AList: TFPHashObjectList;
const Aname: string; Aalign: shortint; Aoptions: TObjSectionOptions); const Aname: string; Aalign: shortint; Aoptions: TObjSectionOptions);
var var
@ -235,7 +251,6 @@ implementation
inherited create(AList, Aname, Aalign, Aoptions); inherited create(AList, Aname, Aalign, Aoptions);
FCombination:=scPublic; FCombination:=scPublic;
FUse:=suUse16; FUse:=suUse16;
FOmfAlignment:=saRelocatableByteAligned;
if oso_executable in Aoptions then if oso_executable in Aoptions then
begin begin
FClassName:='code'; FClassName:='code';
@ -245,13 +260,11 @@ implementation
begin begin
FClassName:='stack'; FClassName:='stack';
FCombination:=scStack; FCombination:=scStack;
FOmfAlignment:=saRelocatableParaAligned;
dgroup:=current_settings.x86memorymodel in (x86_near_data_models-[mm_tiny]); dgroup:=current_settings.x86memorymodel in (x86_near_data_models-[mm_tiny]);
end end
else if Aname='heap' then else if Aname='heap' then
begin begin
FClassName:='heap'; FClassName:='heap';
FOmfAlignment:=saRelocatableParaAligned;
dgroup:=current_settings.x86memorymodel in x86_near_data_models; dgroup:=current_settings.x86memorymodel in x86_near_data_models;
end end
else if Aname='bss' then else if Aname='bss' then
@ -262,7 +275,6 @@ implementation
else if Aname='data' then else if Aname='data' then
begin begin
FClassName:='data'; FClassName:='data';
FOmfAlignment:=saRelocatableWordAligned;
dgroup:=true; dgroup:=true;
end end
else else