소스 검색

+ 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 -

nickysn 7 년 전
부모
커밋
45337b67fe
3개의 변경된 파일23개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      compiler/ogomf.pas
  2. 21 3
      compiler/omfbase.pas
  3. 1 1
      compiler/x86/agx86nsm.pas

+ 1 - 1
compiler/ogomf.pas

@@ -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 }

+ 21 - 3
compiler/omfbase.pas

@@ -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}

+ 1 - 1
compiler/x86/agx86nsm.pas

@@ -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;