+ when using the i8086 with section based smartlinking, create OMF section

groups, named 'CGROUP' or 'CGROUP_UNITNAME', which include all the code
  sections, that need to be put in the same segment

git-svn-id: trunk@39277 -
This commit is contained in:
nickysn 2018-06-22 15:02:39 +00:00
parent f07658d3dc
commit 45337b67fe
3 changed files with 23 additions and 5 deletions

View File

@ -643,7 +643,7 @@ implementation
TOmfObjSection(Result).FUse:=suUse32;
TOmfObjSection(Result).SizeLimit:=high(longword);
end;
primary_group:=omf_section_primary_group(atype);
primary_group:=omf_section_primary_group(atype,aname);
if primary_group<>'' then
begin
{ find the primary group, if it already exists, else create it }

View File

@ -1263,14 +1263,15 @@ interface
{ 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;
function omf_section_primary_group(atype:TAsmSectiontype):string;
function omf_section_primary_group(atype:TAsmSectiontype;const aname:string):string;
implementation
uses
cutils,globtype,globals,
cpuinfo,
verbose;
verbose,
fmodule;
{ TOmfOrderedNameCollection }
@ -2873,11 +2874,28 @@ implementation
{$endif i8086}
end;
function omf_section_primary_group(atype: TAsmSectiontype): string;
function omf_section_primary_group(atype: TAsmSectiontype;const aname:string): string;
begin
{$ifdef i8086}
if section_belongs_to_dgroup(atype) then
result:='DGROUP'
else if create_smartlink_sections and (aname<>'') then
begin
case omf_segclass(atype) of
'CODE':
if current_settings.x86memorymodel in x86_far_code_models then
begin
if cs_huge_code in current_settings.moduleswitches then
result:=''
else
result:='CGROUP_'+current_module.modulename^;
end
else
result:='CGROUP';
else
result:='';
end;
end
else
result:='';
{$else i8086}

View File

@ -596,7 +596,7 @@ interface
writer.AsmWrite(' class='+omf_segclass(atype)+
' align='+tostr(omf_sectiontype2align(atype)));
TX86NasmSection.Create(FSections,secname);
secgroup:=omf_section_primary_group(atype);
secgroup:=omf_section_primary_group(atype,aname);
if secgroup<>'' then
AddSegmentToGroup(secgroup,secname);
end;