Przeglądaj źródła

* moved the omf section names constant to the omfbase unit and use it also in
the nasm asm writer when targeting i8086-msdos

git-svn-id: trunk@31481 -

nickysn 10 lat temu
rodzic
commit
1a8e203bf5
3 zmienionych plików z 63 dodań i 59 usunięć
  1. 2 58
      compiler/ogomf.pas
  2. 58 0
      compiler/omfbase.pas
  3. 3 1
      compiler/x86/agx86nsm.pas

+ 2 - 58
compiler/ogomf.pas

@@ -582,69 +582,13 @@ implementation
       end;
       end;
 
 
     function TOmfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
     function TOmfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
-      const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
-          'text',
-          'data',
-          'data',
-          'rodata',
-          'bss',
-          'tbss',
-          'pdata',
-          'text','data','data','data','data',
-          'stab',
-          'stabstr',
-          'idata2','idata4','idata5','idata6','idata7','edata',
-          'eh_frame',
-          'debug_frame','debug_info','debug_line','debug_abbrev',
-          'fpc',
-          '',
-          'init',
-          'fini',
-          'objc_class',
-          'objc_meta_class',
-          'objc_cat_cls_meth',
-          'objc_cat_inst_meth',
-          'objc_protocol',
-          'objc_string_object',
-          'objc_cls_meth',
-          'objc_inst_meth',
-          'objc_cls_refs',
-          'objc_message_refs',
-          'objc_symbols',
-          'objc_category',
-          'objc_class_vars',
-          'objc_instance_vars',
-          'objc_module_info',
-          'objc_class_names',
-          'objc_meth_var_types',
-          'objc_meth_var_names',
-          'objc_selector_strs',
-          'objc_protocol_ext',
-          'objc_class_ext',
-          'objc_property',
-          'objc_image_info',
-          'objc_cstring_object',
-          'objc_sel_fixup',
-          '__DATA,__objc_data',
-          '__DATA,__objc_const',
-          'objc_superrefs',
-          '__DATA, __datacoal_nt,coalesced',
-          'objc_classlist',
-          'objc_nlclasslist',
-          'objc_catlist',
-          'obcj_nlcatlist',
-          'objc_protolist',
-          'stack',
-          'heap'
-        );
       begin
       begin
         if (atype=sec_user) then
         if (atype=sec_user) then
           Result:=aname
           Result:=aname
-        else if secnames[atype]='text' then
+        else if omf_secnames[atype]=omf_secnames[sec_code] then
           Result:=CodeSectionName(aname)
           Result:=CodeSectionName(aname)
         else
         else
-          Result:=secnames[atype];
+          Result:=omf_secnames[atype];
       end;
       end;
 
 
     procedure TOmfObjData.writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
     procedure TOmfObjData.writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);

+ 58 - 0
compiler/omfbase.pas

@@ -28,9 +28,67 @@ interface
 {$H+}
 {$H+}
   uses
   uses
     cclasses,
     cclasses,
+    aasmbase,
     owbase;
     owbase;
 
 
   const
   const
+    { OMF segment names for the object sections, produced by the FPC code generator }
+    omf_secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
+      'text',
+      'data',
+      'data',
+      'rodata',
+      'bss',
+      'tbss',
+      'pdata',
+      'text','data','data','data','data',
+      'stab',
+      'stabstr',
+      'idata2','idata4','idata5','idata6','idata7','edata',
+      'eh_frame',
+      'debug_frame','debug_info','debug_line','debug_abbrev',
+      'fpc',
+      '',
+      'init',
+      'fini',
+      'objc_class',
+      'objc_meta_class',
+      'objc_cat_cls_meth',
+      'objc_cat_inst_meth',
+      'objc_protocol',
+      'objc_string_object',
+      'objc_cls_meth',
+      'objc_inst_meth',
+      'objc_cls_refs',
+      'objc_message_refs',
+      'objc_symbols',
+      'objc_category',
+      'objc_class_vars',
+      'objc_instance_vars',
+      'objc_module_info',
+      'objc_class_names',
+      'objc_meth_var_types',
+      'objc_meth_var_names',
+      'objc_selector_strs',
+      'objc_protocol_ext',
+      'objc_class_ext',
+      'objc_property',
+      'objc_image_info',
+      'objc_cstring_object',
+      'objc_sel_fixup',
+      '__DATA,__objc_data',
+      '__DATA,__objc_const',
+      'objc_superrefs',
+      '__DATA, __datacoal_nt,coalesced',
+      'objc_classlist',
+      'objc_nlclasslist',
+      'objc_catlist',
+      'obcj_nlcatlist',
+      'objc_protolist',
+      'stack',
+      'heap'
+    );
+
     { OMF record types }
     { OMF record types }
     RT_THEADR    = $80;  { Translator Header Record }
     RT_THEADR    = $80;  { Translator Header Record }
     RT_LHEADR    = $82;  { Library Module Header Record }
     RT_LHEADR    = $82;  { Library Module Header Record }

+ 3 - 1
compiler/x86/agx86nsm.pas

@@ -61,7 +61,7 @@ interface
 
 
     uses
     uses
       cutils,globals,systems,cclasses,
       cutils,globals,systems,cclasses,
-      fmodule,finput,verbose,cpuinfo,cgbase
+      fmodule,finput,verbose,cpuinfo,cgbase,omfbase
       ;
       ;
 
 
     const
     const
@@ -539,6 +539,8 @@ interface
                 (current_settings.x86memorymodel in x86_far_data_models) then
                 (current_settings.x86memorymodel in x86_far_data_models) then
           AsmWrite('heap class=HEAP align=16')
           AsmWrite('heap class=HEAP align=16')
 {$endif i8086}
 {$endif i8086}
+        else if target_info.system=system_i8086_msdos then
+          AsmWrite(omf_secnames[atype])
         else
         else
           AsmWrite(secnames[atype]);
           AsmWrite(secnames[atype]);
         if create_smartlink_sections and
         if create_smartlink_sections and