From 7ef279364b0e190f8c971243248de38d8f3f5fbe Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 14 Mar 2009 15:33:59 +0000 Subject: [PATCH] * disable smart linking when using DWARF debug info (doesn't work on all platforms) git-svn-id: trunk@12887 - --- compiler/options.pas | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/compiler/options.pas b/compiler/options.pas index 1efb2c2ae6..4c1f043e79 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -59,6 +59,7 @@ Type procedure parsecmd(cmd:string); procedure TargetOptions(def:boolean); procedure CheckOptionsCompatibility; + procedure ForceStaticLinking; end; TOptionClass=class of toption; @@ -446,6 +447,18 @@ begin end; +procedure toption.ForceStaticLinking; +begin + def_system_macro('FPC_LINK_STATIC'); + undef_system_macro('FPC_LINK_SMART'); + undef_system_macro('FPC_LINK_DYNAMIC'); + include(init_settings.globalswitches,cs_link_static); + exclude(init_settings.globalswitches,cs_link_smart); + exclude(init_settings.globalswitches,cs_link_shared); + LinkTypeSetExplicitly:=true; +end; + + function Toption.Unsetbool(var Opts:TCmdStr; Pos: Longint):boolean; { checks if the character after pos in Opts is a + or a - and returns resp. false or true. If it is another character (or none), it also returns false } @@ -1670,13 +1683,7 @@ begin end; 'S' : begin - def_system_macro('FPC_LINK_STATIC'); - undef_system_macro('FPC_LINK_SMART'); - undef_system_macro('FPC_LINK_DYNAMIC'); - include(init_settings.globalswitches,cs_link_static); - exclude(init_settings.globalswitches,cs_link_smart); - exclude(init_settings.globalswitches,cs_link_shared); - LinkTypeSetExplicitly:=true; + ForceStaticLinking; end; 'X' : begin @@ -2201,6 +2208,11 @@ begin Message(option_switch_bin_to_src_assembler); set_target_asm(target_info.assemextern); end; + + { smart linking does not yet work with DWARF debug info } + if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and + (cs_link_smart in init_settings.globalswitches) then + ForceStaticLinking; end;