aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2010-03-01 12:44:33 +0000
committerRainer Orth <ro@gcc.gnu.org>2010-03-01 12:44:33 +0000
commit291c0a12c4a00c0aa5a67e570e3194b808ad6946 (patch)
treec4f01cb4ed5360a60f66245fa6a8669fe3ee1f42
parent72a30e3cf031aadb2b82ef53ad14daac907bf8c3 (diff)
downloadgcc-291c0a12c4a00c0aa5a67e570e3194b808ad6946.zip
gcc-291c0a12c4a00c0aa5a67e570e3194b808ad6946.tar.gz
gcc-291c0a12c4a00c0aa5a67e570e3194b808ad6946.tar.bz2
re PR pch/14940 (PCH largefile test fails on various platforms)
gcc: PR pch/14940 * config/host-solaris.c (HOST_HOOKS_GT_PCH_GET_ADDRESS): Redefine to sol_gt_pch_get_address. (TRY_EMPTY_VM_SPACE): Define for all combinations of 32 and 64-bit, SPARC and x86. (sol_gt_pch_get_address): New function. gcc/testsuite: PR pch/14940 * gcc.dg/pch/pch.exp: Don't XFAIL largefile.c on i?86-*-solaris2.10. From-SVN: r157141
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/host-solaris.c41
-rw-r--r--gcc/testsuite/gcc.dg/pch/pch.exp1
3 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1e6ab7f..26c5031 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR pch/14940
+ * config/host-solaris.c (HOST_HOOKS_GT_PCH_GET_ADDRESS): Redefine
+ to sol_gt_pch_get_address.
+ (TRY_EMPTY_VM_SPACE): Define for all combinations of 32 and
+ 64-bit, SPARC and x86.
+ (sol_gt_pch_get_address): New function.
+
2010-03-01 Marco Poletti <poletti.marco@gmail.com>
* toplev.h (inform_n, error_n): Declare.
diff --git a/gcc/config/host-solaris.c b/gcc/config/host-solaris.c
index 3a36705..1d51a8d 100644
--- a/gcc/config/host-solaris.c
+++ b/gcc/config/host-solaris.c
@@ -1,5 +1,5 @@
/* Solaris host-specific hook definitions.
- Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -25,9 +25,48 @@
#include "hosthooks-def.h"
+#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
+#define HOST_HOOKS_GT_PCH_GET_ADDRESS sol_gt_pch_get_address
#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
#define HOST_HOOKS_GT_PCH_USE_ADDRESS sol_gt_pch_use_address
+/* For various ports, try to guess a fixed spot in the vm space
+ that's probably free. Based on McDougall, Mauro, Solaris Internals, 2nd
+ ed., p.460-461, fig. 9-3, 9-4, 9-5. */
+#if defined(__sparcv9__)
+/* This low to avoid VA hole on UltraSPARC I/II. */
+# define TRY_EMPTY_VM_SPACE 0x70000000000
+#elif defined(__sparc__)
+# define TRY_EMPTY_VM_SPACE 0x80000000
+#elif defined(__x86_64__)
+# define TRY_EMPTY_VM_SPACE 0x8000000000000000
+#elif defined(__i386__)
+# define TRY_EMPTY_VM_SPACE 0xB0000000
+#else
+# define TRY_EMPTY_VM_SPACE 0
+#endif
+
+/* Determine a location where we might be able to reliably allocate
+ SIZE bytes. FD is the PCH file, though we should return with the
+ file unmapped. */
+
+static void *
+sol_gt_pch_get_address (size_t size, int fd)
+{
+ void *addr;
+
+ addr = mmap ((caddr_t) TRY_EMPTY_VM_SPACE, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE, fd, 0);
+
+ /* If we failed the map, that means there's *no* free space. */
+ if (addr == (void *) MAP_FAILED)
+ return NULL;
+ /* Unmap the area before returning. */
+ munmap ((caddr_t) addr, size);
+
+ return addr;
+}
+
/* Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at
mapping the data at BASE, -1 if we couldn't. */
diff --git a/gcc/testsuite/gcc.dg/pch/pch.exp b/gcc/testsuite/gcc.dg/pch/pch.exp
index ff2b34c..009fc96 100644
--- a/gcc/testsuite/gcc.dg/pch/pch.exp
+++ b/gcc/testsuite/gcc.dg/pch/pch.exp
@@ -43,7 +43,6 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
set test "largefile.c"
set testh "largefile.hs"
set f [open $test w]
-puts $f "/* { dg-xfail-if \"PR 14940\" { \"i?86-*-solaris2.10\" } { \"*\" } { \"\" } } */"
puts $f "/* { dg-timeout-factor 4.0 } */"
set v 0
for { set v 0 } { $v < 10000 } { incr v } {