瀏覽代碼

- Removed generic implementation of TObjData.sectionname, its existence is useless because it is completely overridden by all TObjData descendants.
- Removed separate ELF section names for PIC. The only difference was .data named .data.rel; however .rel suffix has nothing to do with PIC. It only signifies that the section has relocations so such sections can be grouped together in output file and reduce number of pages for dynamic linker to visit while resolving the relocations at load time. At the same time, no existing link scripts distinguish between .rel and any other suffix (except .rel.ro, but it's a different story), meaning that long section names will break .rel grouping.
While support for .data.rel can be added similar to existing rodata handling (separate sec_data and sec_data_norel sections), this doesn't seem worth the trouble.

git-svn-id: trunk@22915 -

sergei 12 年之前
父節點
當前提交
d019670495
共有 2 個文件被更改,包括 2 次插入141 次删除
  1. 1 79
      compiler/ogbase.pas
  2. 1 62
      compiler/ogelf.pas

+ 1 - 79
compiler/ogbase.pas

@@ -270,7 +270,7 @@ interface
        constructor create(const n:string);virtual;
        destructor  destroy;override;
        { Sections }
-       function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;virtual;
+       function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;virtual;abstract;
        function  sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;virtual;
        function  sectiontype2align(atype:TAsmSectiontype):shortint;virtual;
        function  createsection(atype:TAsmSectionType;const aname:string='';aorder:TAsmSectionOrder=secorder_default):TObjSection;
@@ -950,84 +950,6 @@ implementation
       end;
 
 
-    function TObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
-      const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
-          'code',
-          'Data',
-          'Data',
-          'roData',
-          'bss',
-          'threadvar',
-          'pdata',
-          'stub',
-          'data_nonlazy',
-          'data_lazy',
-          'init_func',
-          'term_func',
-          'stab','stabstr',
-          'iData2','iData4','iData5','iData6','iData7','eData',
-          'eh_frame',
-          'debug_frame','debug_info','debug_line','debug_abbrev',
-          'fpc',
-          'toc',
-          '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'
-        );
-      var
-        sep : string[3];
-      begin
-        if aname<>'' then
-          begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
-            result:=secnames[atype]+sep+aname
-          end
-        else
-          result:=secnames[atype];
-      end;
-
-
     function TObjData.sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
       const
         secoptions : array[TAsmSectiontype] of TObjSectionOptions = ([],

+ 1 - 62
compiler/ogelf.pas

@@ -1001,63 +1001,6 @@ implementation
           '.obcj_nlcatlist',
           '.objc_protolist'
         );
-        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
-          '.text',
-          '.data.rel',
-          '.data.rel',
-          '.data.rel',
-          '.bss',
-          '.threadvar',
-          '.pdata',
-          '', { stubs }
-          '__DATA,__nl_symbol_ptr',
-          '__DATA,__la_symbol_ptr',
-          '__DATA,__mod_init_func',
-          '__DATA,__mod_term_func',
-          '.stab',
-          '.stabstr',
-          '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
-          '.eh_frame',
-          '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
-          '.fpc',
-          '.toc',
-          '.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'
-        );
       var
         sep : string[3];
         secname : string;
@@ -1067,11 +1010,7 @@ implementation
           result:=aname
         else
           begin
-            if (cs_create_pic in current_settings.moduleswitches) and
-               not(target_info.system in systems_darwin) then
-              secname:=secnames_pic[atype]
-            else
-              secname:=secnames[atype];
+            secname:=secnames[atype];
             if (atype=sec_fpc) and (Copy(aname,1,3)='res') then
               begin
                 result:=secname+'.'+aname;