Selaa lähdekoodia

* fixed selection of startup code files for all iOS and simulator targets
o in particular fixes linking for the iPhoneSimulator 8.3 and later on
i386

git-svn-id: trunk@31045 -

Jonas Maebe 10 vuotta sitten
vanhempi
commit
acd88cac92
1 muutettua tiedostoa jossa 101 lisäystä ja 46 poistoa
  1. 101 46
      compiler/systems/t_bsd.pas

+ 101 - 46
compiler/systems/t_bsd.pas

@@ -230,28 +230,49 @@ begin
     begin
       if not(cs_profile in current_settings.moduleswitches) then
         begin
-          { 10.8 and later: no crt1.* }
-          if CompareVersionStrings(MacOSXVersionMin,'10.8')>=0 then
-            exit('');
-          { x86: crt1.10.6.o -> crt1.10.5.o -> crt1.o }
-          { others: crt1.10.5 -> crt1.o }
-{$if defined(i386) or defined(x86_64)}
-          if CompareVersionStrings(MacOSXVersionMin,'10.6')>=0 then
-            exit('crt1.10.6.o');
-{$endif}
-          if CompareVersionStrings(MacOSXVersionMin,'10.5')>=0 then
-            exit('crt1.10.5.o');
-{$if defined(arm)}
-          { iOS:
-              iOS 6 and later: nothing
-              iOS 3.1 - 5.x: crt1.3.1.o
-              pre-iOS 3.1: crt1.o
-          }
-          if (CompareVersionStrings(iPhoneOSVersionMin,'6.0')>=0) then
-            exit('');
-          if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
-            exit('crt1.3.1.o');
-{$endif}
+          case target_info.system of
+            system_powerpc_darwin,
+            system_powerpc64_darwin,
+            system_i386_darwin,
+            system_x86_64_darwin:
+              begin
+                { 10.8 and later: no crt1.* }
+                if CompareVersionStrings(MacOSXVersionMin,'10.8')>=0 then
+                  exit('');
+                { x86: crt1.10.6.o -> crt1.10.5.o -> crt1.o }
+                { others: crt1.10.5 -> crt1.o }
+                if (target_info.system in [system_i386_darwin,system_x86_64_darwin]) and
+                   (CompareVersionStrings(MacOSXVersionMin,'10.6')>=0) then
+                  exit('crt1.10.6.o');
+                if CompareVersionStrings(MacOSXVersionMin,'10.5')>=0 then
+                  exit('crt1.10.5.o');
+              end;
+            system_arm_darwin:
+              begin
+                { iOS:
+                    iOS 6 and later: nothing
+                    iOS 3.1 - 5.x: crt1.3.1.o
+                    pre-iOS 3.1: crt1.o
+                }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'6.0')>=0) then
+                  exit('');
+                if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
+                  exit('crt1.3.1.o');
+              end;
+            system_i386_iphonesim,
+            system_x86_64_iphonesim:
+              begin
+                { "recent versions" must not use anything (https://github.com/llvm-mirror/clang/commit/e6d04f3d152a22077022cf9287d4c538a0918ab0 )
+                  What those recent versions could be, is anyone's guess. It
+                  still seems to work with 8.1 and no longer with 8.3, so use
+                  8.1 as a cut-off point }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'8.1')>0) then
+                  exit('');
+              end;
+            system_aarch64_darwin:
+              { never anything }
+              exit('');
+          end;
           { nothing special -> default }
           result:='crt1.o';
         end
@@ -268,34 +289,68 @@ begin
     begin
       if (apptype=app_bundle) then
         begin
-          { < 10.6: bundle1.o
-            >= 10.6: nothing }
-          if CompareVersionStrings(MacOSXVersionMin,'10.6')>=0 then
-            exit('');
-          { iOS: < 3.1: bundle1.o
-                 >= 3.1: nothing }
-{$if defined(arm)}
-          if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
-            exit('');
-{$endif}
+          case target_info.system of
+            system_powerpc_darwin,
+            system_powerpc64_darwin,
+            system_i386_darwin,
+            system_x86_64_darwin:
+              begin
+                { < 10.6: bundle1.o
+                  >= 10.6: nothing }
+                if CompareVersionStrings(MacOSXVersionMin,'10.6')>=0 then
+                  exit('');
+              end;
+            system_arm_darwin,
+            system_aarch64_darwin:
+              begin
+                { iOS: < 3.1: bundle1.o
+                       >= 3.1: nothing }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
+                  exit('');
+              end;
+            system_i386_iphonesim,
+            system_x86_64_iphonesim:
+              begin
+                { see rule for crt1.o }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'8.1')>0) then
+                  exit('');
+              end;
+          end;
           result:='bundle1.o';
         end
       else
         begin
-          { >= 10.6: nothing
-            = 10.5: dylib1.10.5.o
-            < 10.5: dylib1.o
-          }
-          if CompareVersionStrings(MacOSXVersionMin,'10.6')>=0 then
-            exit('');
-          if CompareVersionStrings(MacOSXVersionMin,'10.5')>=0 then
-            exit('dylib1.10.5.o');
-          { iOS: < 3.1: dylib1.o
-                 >= 3.1: nothing }
-{$if defined(arm)}
-          if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
-            exit('');
-{$endif}
+          case target_info.system of
+            system_powerpc_darwin,
+            system_powerpc64_darwin,
+            system_i386_darwin,
+            system_x86_64_darwin:
+              begin
+                { >= 10.6: nothing
+                  = 10.5: dylib1.10.5.o
+                  < 10.5: dylib1.o
+                }
+                if CompareVersionStrings(MacOSXVersionMin,'10.6')>=0 then
+                  exit('');
+                if CompareVersionStrings(MacOSXVersionMin,'10.5')>=0 then
+                  exit('dylib1.10.5.o');
+              end;
+            system_arm_darwin,
+            system_aarch64_darwin:
+              begin
+                { iOS: < 3.1: dylib1.o
+                       >= 3.1: nothing }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'3.1')>=0) then
+                  exit('');
+              end;
+            system_i386_iphonesim,
+            system_x86_64_iphonesim:
+              begin
+                { see rule for crt1.o }
+                if (CompareVersionStrings(iPhoneOSVersionMin,'8.1')>0) then
+                  exit('');
+              end;
+          end;
           result:='dylib1.o';
         end;
     end;