Pārlūkot izejas kodu

* make PIC generation default on Darwin (ppc and i386; ppc64 will be
done in next commit to ease merging)

git-svn-id: trunk@8872 -

Jonas Maebe 18 gadi atpakaļ
vecāks
revīzija
ff3b455a59
3 mainītis faili ar 16 papildinājumiem un 8 dzēšanām
  1. 12 5
      compiler/options.pas
  2. 2 1
      compiler/systems.pas
  3. 2 2
      compiler/systems/i_bsd.pas

+ 12 - 5
compiler/options.pas

@@ -56,7 +56,7 @@ Type
     procedure Interpret_file(const filename : string);
     procedure Read_Parameters;
     procedure parsecmd(cmd:string);
-    procedure TargetDefines(def:boolean);
+    procedure TargetOptions(def:boolean);
   end;
 
   TOptionClass=class of toption;
@@ -1195,7 +1195,7 @@ begin
                if paratarget=system_none then
                 begin
                   { remove old target define }
-                  TargetDefines(false);
+                  TargetOptions(false);
                   { load new target }
                   paratarget:=find_system_by_string(More);
                   if paratarget<>system_none then
@@ -1203,7 +1203,7 @@ begin
                   else
                     IllegalPara(opt);
                   { set new define }
-                  TargetDefines(true);
+                  TargetOptions(true);
                 end
                else
                 if More<>upper(target_info.shortname) then
@@ -1895,7 +1895,7 @@ begin
 end;
 
 
-procedure TOption.TargetDefines(def:boolean);
+procedure TOption.TargetOptions(def:boolean);
 var
   s : string;
   i : integer;
@@ -1985,6 +1985,13 @@ begin
       def_system_macro('FPC_CPUCROSSCOMPILING')
     else
       def_system_macro('FPC_CPUCROSSCOMPILING');
+
+  { Code generation flags }
+  if def and
+     (tf_pic_default in target_info.flags) then
+    include(init_settings.moduleswitches,cs_create_pic)
+  else
+    exclude(init_settings.moduleswitches,cs_create_pic);
 end;
 
 
@@ -2078,7 +2085,7 @@ begin
   disable_configfile:=false;
 
   { Non-core target defines }
-  Option.TargetDefines(true);
+  Option.TargetOptions(true);
 
 { get default messagefile }
   msgfilename:=GetEnvironmentVariable('PPC_ERROR_FILE');

+ 2 - 1
compiler/systems.pas

@@ -311,7 +311,8 @@ interface
             tf_dwarf_relative_addresses,         // use offsets where the Dwarf spec requires this instead of absolute addresses (the latter is needed by Linux binutils)
             tf_dwarf_only_local_labels,          // only use local labels inside the Dwarf debug_info section (needed for e.g. Darwin)
             tf_requires_proper_alignment,
-            tf_no_pic_supported
+            tf_no_pic_supported,
+            tf_pic_default
        );
 
        psysteminfo = ^tsysteminfo;

+ 2 - 2
compiler/systems/i_bsd.pas

@@ -399,7 +399,7 @@ unit i_bsd;
             system       : system_powerpc_darwin;
             name         : 'Darwin for PowerPC';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels];
+            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
             cpu          : cpu_powerpc;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -460,7 +460,7 @@ unit i_bsd;
             system       : system_i386_darwin;
             name         : 'Darwin for i386';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_uses_got];
+            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_uses_got,tf_pic_default];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';