backport: re PR pch/14940 (PCH largefile test fails on various platforms)

Backport from mainline:
	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.

From-SVN: r160176
This commit is contained in:
Rainer Orth 2010-06-02 17:28:24 +00:00 committed by Rainer Orth
parent 11b35a1af6
commit 88d0b1d04f
3 changed files with 52 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2010-06-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline:
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-06-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline:

View File

@ -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. */

View File

@ -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 } {