Browse Source

--- Merging r31042 into '.':
U rtl/linux/bunxsysc.inc
--- Recording mergeinfo for merge of r31042 into '.':
U .
--- Merging r31045 into '.':
U compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r31045 into '.':
G .

git-svn-id: branches/fixes_3_0_ios@31138 -

Jonas Maebe 10 years ago
parent
commit
b00d2137f3
2 changed files with 110 additions and 50 deletions
  1. 101 46
      compiler/systems/t_bsd.pas
  2. 9 4
      rtl/linux/bunxsysc.inc

+ 101 - 46
compiler/systems/t_bsd.pas

@@ -230,28 +230,49 @@ begin
     begin
     begin
       if not(cs_profile in current_settings.moduleswitches) then
       if not(cs_profile in current_settings.moduleswitches) then
         begin
         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 }
           { nothing special -> default }
           result:='crt1.o';
           result:='crt1.o';
         end
         end
@@ -268,34 +289,68 @@ begin
     begin
     begin
       if (apptype=app_bundle) then
       if (apptype=app_bundle) then
         begin
         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';
           result:='bundle1.o';
         end
         end
       else
       else
         begin
         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';
           result:='dylib1.o';
         end;
         end;
     end;
     end;

+ 9 - 4
rtl/linux/bunxsysc.inc

@@ -492,10 +492,15 @@ function fpPoll(fds: ppollfd; nfds: cuint; timeout: clong): cint;
 {$if defined(generic_linux_syscalls)}
 {$if defined(generic_linux_syscalls)}
 var ts : timespec;
 var ts : timespec;
 begin
 begin
-  ts.tv_sec := timeout div 1000;
-  ts.tv_nsec := (timeout mod 1000) * 1000000;
-  fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),
-                     tsysparam(@ts),0);
+  if timeout<0 then
+    fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),0,0)
+  else
+    begin
+      ts.tv_sec := timeout div 1000;
+      ts.tv_nsec := (timeout mod 1000) * 1000000;
+      fpPoll:=do_syscall(syscall_nr_ppoll,tsysparam(fds),tsysparam(nfds),
+                         tsysparam(@ts),0);
+    end
 end;
 end;
 {$else}
 {$else}
 begin
 begin