host-darwin.c (darwin_rs6000_gt_pch_use_address): Fix the check for abort and only...
authorIan Lance Taylor <ian@wasabisystems.com>
Mon, 15 Mar 2004 22:47:57 +0000 (22:47 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Mon, 15 Mar 2004 22:47:57 +0000 (14:47 -0800)
2004-03-15  Ian Lance Taylor  <ian@wasabisystems.com>

        * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address):
        Fix the check for abort and only do the mmap if we can.

From-SVN: r79512

gcc/ChangeLog
gcc/config/rs6000/host-darwin.c

index 1f6036839c4b0f3b6c54b7829cadb27282df9b0d..458ae138e717fd1d51dce8ee7900a4d54a11deee 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-15  Ian Lance Taylor  <ian@wasabisystems.com>
+
+       * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address):
+       Fix the check for abort and only do the mmap if we can.
+
 2004-03-15  Eric Botcazou  <ebotcazou@act-europe.fr>
 
        * config/sparc/sparc.h: Rework comments about the code model
index e6263044bc528ab737ed582d12e035c8c1fa777d..9f47cac937d450559b2a0784ef9a96e93564ff42 100644 (file)
@@ -180,16 +180,19 @@ darwin_rs6000_gt_pch_use_address (void *addr, size_t sz, int fd, size_t off)
   if (munmap (pch_address_space + sz, sizeof (pch_address_space) - sz) != 0)
     fatal_error ("couldn't unmap pch_address_space: %m\n");
 
-  mmap_result = mmap (addr, sz,
-                     PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
-                     fd, off);
+  if (ret)
+    {
+      mmap_result = mmap (addr, sz,
+                         PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
+                         fd, off);
 
-  /* The file might not be mmap-able.  */
-  ret = mmap_result == (void *) MAP_FAILED;
+      /* The file might not be mmap-able.  */
+      ret = mmap_result == (void *) MAP_FAILED;
 
-  /* Sanity check for broken MAP_FIXED.  */
-  if (ret && mmap_result != addr)
-    abort ();
+      /* Sanity check for broken MAP_FIXED.  */
+      if (!ret && mmap_result != addr)
+       abort ();
+    }
 
   return ret;
 }