瀏覽代碼

+ initial (experimental) implementation of section-based smartlinking for i8086.
Use -dI8086_SMARTLINK_SECTIONS to enable.

git-svn-id: trunk@39211 -

nickysn 7 年之前
父節點
當前提交
b9ab9e5782
共有 4 個文件被更改,包括 50 次插入14 次删除
  1. 26 6
      compiler/ogomf.pas
  2. 8 2
      compiler/systems/i_embed.pas
  3. 8 3
      compiler/systems/i_msdos.pas
  4. 8 3
      compiler/systems/i_win16.pas

+ 26 - 6
compiler/ogomf.pas

@@ -570,15 +570,35 @@ implementation
       end;
 
     function TOmfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
+      var
+        sep : string[3];
+        secname : string;
       begin
         if (atype=sec_user) then
           Result:=aname
-        else if omf_secnames[atype]=omf_secnames[sec_code] then
-          Result:=CodeSectionName(aname)
-        else if omf_segclass(atype)='FAR_DATA' then
-          Result:=current_module.modulename^ + '_DATA'
         else
-          Result:=omf_secnames[atype];
+          begin
+            if omf_secnames[atype]=omf_secnames[sec_code] then
+              secname:=CodeSectionName(aname)
+            else if omf_segclass(atype)='FAR_DATA' then
+              secname:=current_module.modulename^ + '_DATA'
+            else
+              secname:=omf_secnames[atype];
+            if create_smartlink_sections and (aname<>'') then
+              begin
+                case aorder of
+                  secorder_begin :
+                    sep:='.b_';
+                  secorder_end :
+                    sep:='.z_';
+                  else
+                    sep:='.n_';
+                end;
+                result:=secname+sep+aname
+              end
+            else
+              result:=secname;
+          end;
       end;
 
     function TOmfObjData.createsection(atype: TAsmSectionType; const aname: string; aorder: TAsmSectionOrder): TObjSection;
@@ -2910,7 +2930,7 @@ implementation
             asmbin : '';
             asmcmd : '';
             supported_targets : [system_i8086_msdos,system_i8086_embedded];
-            flags : [af_outputbinary,af_no_debug];
+            flags : [af_outputbinary,af_no_debug,af_smartlink_sections];
             labelprefix : '..@';
             comment : '; ';
             dollarsign: '$';

+ 8 - 2
compiler/systems/i_embed.pas

@@ -360,8 +360,14 @@ unit i_embed;
             system       : system_i8086_embedded;
             name         : 'Embedded';
             shortname    : 'embedded';
-            flags        : [tf_use_8_3,tf_smartlink_library,
-                            tf_no_objectfiles_when_smartlinking,tf_cld,
+            flags        : [tf_use_8_3,
+{$ifdef I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_sections,
+{$else I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_library,
+                            tf_no_objectfiles_when_smartlinking,
+{$endif I8086_SMARTLINK_SECTIONS}
+                            tf_cld,
                             tf_no_generic_stackcheck,tf_emit_stklen];
             cpu          : cpu_i8086;
             unit_env     : '';

+ 8 - 3
compiler/systems/i_msdos.pas

@@ -41,9 +41,14 @@ unit i_msdos;
             system       : system_i8086_msdos;
             name         : 'MS-DOS 16-bit real mode';
             shortname    : 'MSDOS';
-            flags        : [tf_use_8_3,tf_smartlink_library,
-                            tf_no_objectfiles_when_smartlinking,tf_cld,
-                            tf_no_generic_stackcheck,tf_emit_stklen];
+            flags        : [tf_use_8_3,
+{$ifdef I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_sections,
+{$else I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_library,
+                            tf_no_objectfiles_when_smartlinking,
+{$endif I8086_SMARTLINK_SECTIONS}
+                            tf_cld,tf_no_generic_stackcheck,tf_emit_stklen];
             cpu          : cpu_i8086;
             unit_env     : 'MSDOSUNITS';
             extradefines : '';

+ 8 - 3
compiler/systems/i_win16.pas

@@ -41,9 +41,14 @@ unit i_win16;
             system       : system_i8086_win16;
             name         : 'Win16 for x86';
             shortname    : 'Win16';
-            flags        : [tf_use_8_3,tf_smartlink_library,
-                            tf_no_objectfiles_when_smartlinking,tf_cld,
-                            tf_no_generic_stackcheck,tf_emit_stklen,
+            flags        : [tf_use_8_3,
+{$ifdef I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_sections,
+{$else I8086_SMARTLINK_SECTIONS}
+                            tf_smartlink_library,
+                            tf_no_objectfiles_when_smartlinking,
+{$endif I8086_SMARTLINK_SECTIONS}
+                            tf_cld,tf_no_generic_stackcheck,tf_emit_stklen,
                             tf_x86_far_procs_push_odd_bp];
             cpu          : cpu_i8086;
             unit_env     : 'WIN16UNITS';