* override sectiontype2align in the omf writer and set the same alignments as

the ones, currently produced by nasm

git-svn-id: trunk@30602 -
This commit is contained in:
nickysn 2015-04-15 08:31:06 +00:00
parent 955c29618a
commit d7416afd88

View File

@ -82,6 +82,7 @@ interface
class function CodeSectionName(const aname:string): string;
public
constructor create(const n:string);override;
function sectiontype2align(atype:TAsmSectiontype):shortint;override;
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
procedure writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);override;
end;
@ -300,6 +301,33 @@ implementation
CObjSection:=TOmfObjSection;
end;
function TOmfObjData.sectiontype2align(atype: TAsmSectiontype): shortint;
begin
case atype of
sec_stabstr,sec_debug_info,sec_debug_line,sec_debug_abbrev:
result:=1;
sec_code:
result:=1;
sec_bss:
result:=1;
sec_data:
result:=2;
{ For idata (at least idata2) it must be 4 bytes, because
an entry is always (also in win64) 20 bytes and aligning
on 8 bytes will insert 4 bytes between the entries resulting
in a corrupt idata section.
Same story with .pdata, it has 4-byte elements which should
be packed without gaps. }
sec_idata2,sec_idata4,sec_idata5,sec_idata6,sec_idata7,sec_pdata:
result:=4;
sec_stack,
sec_heap:
result:=16;
else
result:=1;
end;
end;
function TOmfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
const
secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',