Explorar o código

* disable smart linking when using DWARF debug info (doesn't work on all
platforms)

git-svn-id: trunk@12887 -

Jonas Maebe %!s(int64=16) %!d(string=hai) anos
pai
achega
7ef279364b
Modificáronse 1 ficheiros con 19 adicións e 7 borrados
  1. 19 7
      compiler/options.pas

+ 19 - 7
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;