mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 08:29:29 +02:00
* the function which returns the alignment of omf sections moved to unit
omfbase, so it can be used by the nasm asm writer as well git-svn-id: trunk@31486 -
This commit is contained in:
parent
3abfa177c4
commit
cc2e27b555
@ -509,32 +509,7 @@ implementation
|
||||
|
||||
function TOmfObjData.sectiontype2align(atype: TAsmSectiontype): shortint;
|
||||
begin
|
||||
case atype of
|
||||
sec_stabstr:
|
||||
result:=1;
|
||||
sec_code:
|
||||
result:=1;
|
||||
sec_data,
|
||||
sec_rodata,
|
||||
sec_rodata_norel,
|
||||
sec_bss:
|
||||
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_debug_frame,sec_debug_info,sec_debug_line,sec_debug_abbrev:
|
||||
result:=4;
|
||||
sec_stack,
|
||||
sec_heap:
|
||||
result:=16;
|
||||
else
|
||||
result:=1;
|
||||
end;
|
||||
Result:=omf_sectiontype2align(atype);
|
||||
end;
|
||||
|
||||
function TOmfObjData.sectiontype2class(atype: TAsmSectiontype): string;
|
||||
|
@ -649,6 +649,7 @@ interface
|
||||
|
||||
function compute_omf_lib_hash(const name: string; blocks: Integer): TOmfLibHash;
|
||||
|
||||
function omf_sectiontype2align(atype:TAsmSectiontype):shortint;
|
||||
{ returns whether the specified section type belongs to the group DGROUP in
|
||||
the current memory model. DGROUP is the segment group pointed by DS }
|
||||
function section_belongs_to_dgroup(atype:TAsmSectiontype): Boolean;
|
||||
@ -1762,6 +1763,36 @@ implementation
|
||||
Result.bucket_d:=max(bucket_d mod nbuckets,1);
|
||||
end;
|
||||
|
||||
function omf_sectiontype2align(atype: TAsmSectiontype): shortint;
|
||||
begin
|
||||
case atype of
|
||||
sec_stabstr:
|
||||
result:=1;
|
||||
sec_code:
|
||||
result:=1;
|
||||
sec_data,
|
||||
sec_rodata,
|
||||
sec_rodata_norel,
|
||||
sec_bss:
|
||||
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_debug_frame,sec_debug_info,sec_debug_line,sec_debug_abbrev:
|
||||
result:=4;
|
||||
sec_stack,
|
||||
sec_heap:
|
||||
result:=16;
|
||||
else
|
||||
result:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function section_belongs_to_dgroup(atype: TAsmSectiontype): Boolean;
|
||||
begin
|
||||
{$ifdef i8086}
|
||||
|
Loading…
Reference in New Issue
Block a user