From ff3b455a599b1f4f4f19e805010aa5326382969b Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 21 Oct 2007 10:34:01 +0000 Subject: [PATCH] * make PIC generation default on Darwin (ppc and i386; ppc64 will be done in next commit to ease merging) git-svn-id: trunk@8872 - --- compiler/options.pas | 17 ++++++++++++----- compiler/systems.pas | 3 ++- compiler/systems/i_bsd.pas | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/compiler/options.pas b/compiler/options.pas index 4d04c9d490..aace63dae3 100644 --- a/compiler/options.pas +++ b/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'); diff --git a/compiler/systems.pas b/compiler/systems.pas index b355b3ef83..7dc7d2605a 100644 --- a/compiler/systems.pas +++ b/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; diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas index 0ecaf1a1a6..9be2945208 100644 --- a/compiler/systems/i_bsd.pas +++ b/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';