+ support mixing initialized and bss data in the same object section (only in

case the section options contain the new option 'oso_sparse_data') in the
  internal object writer (needed for the huge memory model)

git-svn-id: trunk@31503 -
This commit is contained in:
nickysn 2015-09-04 13:16:45 +00:00
parent 1264eaf8c6
commit 4a855b140a
3 changed files with 21 additions and 3 deletions

View File

@ -1413,7 +1413,8 @@ Implementation
end; end;
ait_datablock : ait_datablock :
begin begin
if (oso_data in ObjData.CurrObjSec.secoptions) then if (oso_data in ObjData.CurrObjSec.secoptions) and
not (oso_sparse_data in ObjData.CurrObjSec.secoptions) then
Message(asmw_e_alloc_data_only_in_bss); Message(asmw_e_alloc_data_only_in_bss);
{$ifdef USE_COMM_IN_BSS} {$ifdef USE_COMM_IN_BSS}
if writingpackages and if writingpackages and

View File

@ -157,7 +157,9 @@ interface
{ Must be cloned when writing separate debug file } { Must be cloned when writing separate debug file }
oso_debug_copy, oso_debug_copy,
{ Has relocations with explicit addends (ELF-specific) } { Has relocations with explicit addends (ELF-specific) }
oso_rela_relocs oso_rela_relocs,
{ Supports bss-like allocation of data, even though it is written in file (i.e. also has oso_Data) }
oso_sparse_data
); );
TObjSectionOptions = set of TObjSectionOption; TObjSectionOptions = set of TObjSectionOption;
@ -968,6 +970,9 @@ implementation
if (qword(size)+l)>high(size) then if (qword(size)+l)>high(size) then
SectionTooLargeError; SectionTooLargeError;
{$endif} {$endif}
if oso_sparse_data in SecOptions then
WriteZeros(l)
else
inc(size,l); inc(size,l);
end; end;
@ -1366,6 +1371,8 @@ implementation
Size:=0; Size:=0;
Datapos:=0; Datapos:=0;
mempos:=0; mempos:=0;
if assigned(Data) then
Data.reset;
end; end;
end; end;

View File

@ -100,6 +100,7 @@ interface
class function CodeSectionName(const aname:string): string; class function CodeSectionName(const aname:string): string;
public public
constructor create(const n:string);override; constructor create(const n:string);override;
function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;override;
function sectiontype2align(atype:TAsmSectiontype):shortint;override; function sectiontype2align(atype:TAsmSectiontype):shortint;override;
function sectiontype2class(atype:TAsmSectiontype):string; function sectiontype2class(atype:TAsmSectiontype):string;
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override; function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
@ -507,6 +508,15 @@ implementation
CObjSection:=TOmfObjSection; CObjSection:=TOmfObjSection;
end; end;
function TOmfObjData.sectiontype2options(atype: TAsmSectiontype): TObjSectionOptions;
begin
Result:=inherited sectiontype2options(atype);
{ in the huge memory model, BSS data is actually written in the regular
FAR_DATA segment of the module }
if sectiontype2class(atype)='FAR_DATA' then
Result:=Result+[oso_data,oso_sparse_data];
end;
function TOmfObjData.sectiontype2align(atype: TAsmSectiontype): shortint; function TOmfObjData.sectiontype2align(atype: TAsmSectiontype): shortint;
begin begin
Result:=omf_sectiontype2align(atype); Result:=omf_sectiontype2align(atype);