+ 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;
ait_datablock :
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);
{$ifdef USE_COMM_IN_BSS}
if writingpackages and

View File

@ -157,7 +157,9 @@ interface
{ Must be cloned when writing separate debug file }
oso_debug_copy,
{ 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;
@ -968,7 +970,10 @@ implementation
if (qword(size)+l)>high(size) then
SectionTooLargeError;
{$endif}
inc(size,l);
if oso_sparse_data in SecOptions then
WriteZeros(l)
else
inc(size,l);
end;
@ -1366,6 +1371,8 @@ implementation
Size:=0;
Datapos:=0;
mempos:=0;
if assigned(Data) then
Data.reset;
end;
end;

View File

@ -100,6 +100,7 @@ interface
class function CodeSectionName(const aname:string): string;
public
constructor create(const n:string);override;
function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;override;
function sectiontype2align(atype:TAsmSectiontype):shortint;override;
function sectiontype2class(atype:TAsmSectiontype):string;
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
@ -507,6 +508,15 @@ implementation
CObjSection:=TOmfObjSection;
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;
begin
Result:=omf_sectiontype2align(atype);