Browse Source

* ogelf.pas: cleaned up code that creates default sections.

git-svn-id: trunk@21374 -
sergei 13 years ago
parent
commit
71c8b9cf8a
1 changed files with 3 additions and 14 deletions
  1. 3 14
      compiler/ogelf.pas

+ 3 - 14
compiler/ogelf.pas

@@ -536,27 +536,16 @@ implementation
 ****************************************************************************}
 
     constructor TElfObjData.create(const n:string);
-      var
-        need_datarel : boolean;
       begin
         inherited create(n);
         CObjSection:=TElfObjSection;
         { we need at least the following sections }
         createsection(sec_code);
+        { always a non-PIC data section (will remain empty if doing PIC) }
+        createsection('.data',sizeof(pint),sectiontype2options(sec_data));
+        createsection(sec_bss);
         if (cs_create_pic in current_settings.moduleswitches) and
            not(target_info.system in systems_darwin) then
-          begin
-            { We still need an empty data section }
-            system.exclude(current_settings.moduleswitches,cs_create_pic);
-            need_datarel:=true;
-          end
-        else
-          need_datarel:=false;
-        createsection(sec_data);
-        if need_datarel then
-          system.include(current_settings.moduleswitches,cs_create_pic);
-        createsection(sec_bss);
-        if need_datarel then
           createsection(sec_data);
         if tf_section_threadvars in target_info.flags then
           createsection(sec_threadvar);