From c44322801aab5ea81cce85a452082a707a97b45e Mon Sep 17 00:00:00 2001 From: pinskia Date: Mon, 15 Mar 2004 22:47:57 +0000 Subject: [PATCH 1/1] 2004-03-15 Ian Lance Taylor * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address): Fix the check for abort and only do the mmap if we can. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79512 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/host-darwin.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f6036839c4..458ae138e71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-03-15 Ian Lance Taylor + + * 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 * config/sparc/sparc.h: Rework comments about the code model diff --git a/gcc/config/rs6000/host-darwin.c b/gcc/config/rs6000/host-darwin.c index e6263044bc5..9f47cac937d 100644 --- a/gcc/config/rs6000/host-darwin.c +++ b/gcc/config/rs6000/host-darwin.c @@ -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; } -- 2.11.0