re PR bootstrap/3163 ([3.3 Only] gcc/aclocal.m4 mmap test fails on UnixWare 7.1.1)

PR bootstrap/3163
	* aclocal.m4 (AC_FUNC_MMAP_ANYWHERE, AC_FUNC_MMAP_FILE): Delete.
	(gcc_AC_FUNC_MMAP_BLACKLIST): New.
	* configure.in: Check for sys/mman.h and mmap in AC_CHECK_HEADERS
	and AC_CHECK_FUNCS lists, respectively.  Use
	gcc_AC_FUNC_MMAP_BLACKLIST, not AC_FUNC_MMAP_ANYWHERE nor
	AC_FUNC_MMAP_FILE.
	* configure, config.in: Regenerate.

From-SVN: r67467
This commit is contained in:
Zack Weinberg 2003-06-04 22:21:21 +00:00
parent 88d5a16e0b
commit 1072ec3fdc
5 changed files with 433 additions and 1026 deletions

View File

@ -1,3 +1,14 @@
2003-06-04 Zack Weinberg <zack@codesourcery.com>
PR bootstrap/3163
* aclocal.m4 (AC_FUNC_MMAP_ANYWHERE, AC_FUNC_MMAP_FILE): Delete.
(gcc_AC_FUNC_MMAP_BLACKLIST): New.
* configure.in: Check for sys/mman.h and mmap in AC_CHECK_HEADERS
and AC_CHECK_FUNCS lists, respectively. Use
gcc_AC_FUNC_MMAP_BLACKLIST, not AC_FUNC_MMAP_ANYWHERE nor
AC_FUNC_MMAP_FILE.
* configure, config.in: Regenerate.
2003-06-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* arm/aout.h (ASM_OUTPUT_SKIP): Fix cast for format specifier warning.
@ -9,8 +20,8 @@
2003-06-04 Richard Henderson <rth@redhat.com>
* cse.c (find_best_addr): Consider binary operators even if second
argument is not CONST_INT.
* cse.c (find_best_addr): Consider binary operators even if second
argument is not CONST_INT.
2003-06-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
@ -72,8 +83,8 @@
2003-06-04 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000.c (rs6000_complex_function_value): Unpack
complex numbers <= 32 bits into two registers.
* config/rs6000/rs6000.c (rs6000_complex_function_value): Unpack
complex numbers <= 32 bits into two registers.
2003-06-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@ -113,15 +124,15 @@
2003-06-04 Richard Henderson <rth@redhat.com>
* c-common.c (handle_cleanup_attribute): New.
(c_common_attributes): Add it.
* c-decl.c (finish_decl): Honor the cleanup attribute.
* doc/extend.texi (Variable Attributes): Document it.
* c-common.c (handle_cleanup_attribute): New.
(c_common_attributes): Add it.
* c-decl.c (finish_decl): Honor the cleanup attribute.
* doc/extend.texi (Variable Attributes): Document it.
* unwind-c.c: New file.
* Makefile.in (LIB2ADDEH): Add it.
* config/t-darwin, config/t-linux, config/t-linux-gnulibc1,
config/ia64/t-ia64: Likewise.
* unwind-c.c: New file.
* Makefile.in (LIB2ADDEH): Add it.
* config/t-darwin, config/t-linux, config/t-linux-gnulibc1,
config/ia64/t-ia64: Likewise.
2003-06-04 Jakub Jelinek <jakub@redhat.com>
@ -493,27 +504,27 @@ Wed Jun 4 09:49:21 CEST 2003 Jan Hubicka <jh@suse.cz>
2003-06-03 Aldy Hernandez <aldyh@redhat.com>
* function.c (assign_parms): Split complex arguments.
* function.c (assign_parms): Split complex arguments.
* doc/tm.texi (SPLIT_COMPLEX_ARGS): Document.
* doc/tm.texi (SPLIT_COMPLEX_ARGS): Document.
* expr.h (SPLIT_COMPLEX_ARGS): Define.
(split_complex_types): Protoize.
(split_complex_values): Protoize.
* expr.h (SPLIT_COMPLEX_ARGS): Define.
(split_complex_types): Protoize.
(split_complex_values): Protoize.
* calls.c (expand_call): Split complex arguments on architectures
that require it.
(split_complex_values): New.
(split_complex_types): New.
* calls.c (expand_call): Split complex arguments on architectures
that require it.
(split_complex_values): New.
(split_complex_types): New.
* config/rs6000/rs6000.c (rs6000_libcall_value): New.
(rs6000_function_value): Handle complex values on AIX.
(rs6000_complex_function_value): New.
* config/rs6000/rs6000.c (rs6000_libcall_value): New.
(rs6000_function_value): Handle complex values on AIX.
(rs6000_complex_function_value): New.
* config/rs6000/rs6000-protos.h (rs6000_libcall_value): Protoize.
* config/rs6000/rs6000-protos.h (rs6000_libcall_value): Protoize.
* config/rs6000/rs6000.h (LIBCALL_VALUE): Call function.
(SPLIT_COMPLEX_ARGS): New.
* config/rs6000/rs6000.h (LIBCALL_VALUE): Call function.
(SPLIT_COMPLEX_ARGS): New.
2003-06-03 Jakub Jelinek <jakub@redhat.com>
@ -626,7 +637,7 @@ Wed Jun 4 09:49:21 CEST 2003 Jan Hubicka <jh@suse.cz>
2003-06-02 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* gcc/config.gcc Add support multilib parts for m32rx processor.
* gcc/config.gcc Add support multilib parts for m32rx processor.
2003-06-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>

420
gcc/aclocal.m4 vendored
View File

@ -398,357 +398,93 @@ fi
AC_SUBST($1)dnl
])
# Check whether mmap can map an arbitrary page from /dev/zero or with
# MAP_ANONYMOUS, without MAP_FIXED.
AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
[AC_CHECK_FUNCS(getpagesize)
# The test program for the next two tests is the same except for one
# set of ifdefs.
changequote({{{,}}})dnl
{{{cat >ct-mmap.inc <<'EOF'
#include <sys/types.h>
# mmap(2) blacklisting. Some platforms provide the mmap library routine
# but don't support all of the features we need from it.
AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
[if test $ac_cv_header_sys_mman_h != yes \
|| test $ac_cv_func_mmap != yes; then
gcc_cv_func_mmap_file=no
gcc_cv_func_mmap_dev_zero=no
gcc_cv_func_mmap_anon=no
else
AC_CACHE_CHECK([whether read-only mmap of a plain file works],
gcc_cv_func_mmap_file,
[# Add a system to this blacklist if
# mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
# memory area containing the same data that you'd get if you applied
# read() to the same fd. The only system known to have a problem here
# is VMS, where text files have record structure.
case "$host_os" in
vms*)
gcc_cv_func_mmap_file=no ;;
*)
gcc_cv_func_mmap_file=yes;;
esac])
AC_CACHE_CHECK([whether mmap from /dev/zero works],
gcc_cv_func_mmap_dev_zero,
[# Add a system to this blacklist if it has mmap() but /dev/zero
# does not exist, or if mmapping /dev/zero does not give anonymous
# zeroed pages with both the following properties:
# 1. If you map N consecutive pages in with one call, and then
# unmap any subset of those pages, the pages that were not
# explicitly unmapped remain accessible.
# 2. If you map two adjacent blocks of memory and then unmap them
# both at once, they must both go away.
# Systems known to be in this category are Windows (all variants),
# VMS, and Darwin.
case "$host_os" in
vms* | cygwin* | pe | mingw* | darwin*)
gcc_cv_func_mmap_dev_zero=no ;;
*)
gcc_cv_func_mmap_dev_zero=yes;;
esac])
# Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include <stdio.h>
#include <unistd.h>
#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
],
[int n = MAP_ANONYMOUS;],
gcc_cv_decl_map_anon=yes,
gcc_cv_decl_map_anon=no)])
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
# define HAVE_SYS_PARAM_H 1
# endif
# ifdef _SC_PAGESIZE
# define getpagesize() sysconf(_SC_PAGESIZE)
# else /* no _SC_PAGESIZE */
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else /* no EXEC_PAGESIZE */
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif /* no CLSIZE */
# else /* no NBPG */
# ifdef NBPC
# define getpagesize() NBPC
# else /* no NBPC */
# ifdef PAGESIZE
# define getpagesize() PAGESIZE
# endif /* PAGESIZE */
# endif /* no NBPC */
# endif /* no NBPG */
# endif /* no EXEC_PAGESIZE */
# else /* no HAVE_SYS_PARAM_H */
# define getpagesize() 8192 /* punt totally */
# endif /* no HAVE_SYS_PARAM_H */
# endif /* no _SC_PAGESIZE */
#endif /* no HAVE_GETPAGESIZE */
#ifndef MAP_FAILED
# define MAP_FAILED -1
#endif
#undef perror_exit
#define perror_exit(str, val) \
do { perror(str); exit(val); } while (0)
/* Some versions of cygwin mmap require that munmap is called with the
same parameters as mmap. GCC expects that this is not the case.
Test for various forms of this problem. Warning - icky signal games. */
static sigset_t unblock_sigsegv;
static jmp_buf r;
static size_t pg;
static int devzero;
static char *
anonmap (size)
size_t size;
{
#ifdef USE_MAP_ANON
return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
#else
return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
MAP_PRIVATE, devzero, 0);
#endif
}
static void
sigsegv (unused)
int unused;
{
sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
longjmp (r, 1);
}
/* Basic functionality test. */
void
test_0 ()
{
char *x = anonmap (pg);
if (x == (char *) MAP_FAILED)
perror_exit("test 0 mmap", 2);
*(int *)x += 1;
if (munmap(x, pg) < 0)
perror_exit("test 0 munmap", 3);
}
/* 1. If we map a 2-page region and unmap its second page, the first page
must remain. */
static void
test_1 ()
{
char *x = anonmap (pg * 2);
if (x == (char *)MAP_FAILED)
perror_exit ("test 1 mmap", 4);
signal (SIGSEGV, sigsegv);
if (setjmp (r))
perror_exit ("test 1 fault", 5);
x[0] = 1;
x[pg] = 1;
if (munmap (x + pg, pg) < 0)
perror_exit ("test 1 munmap 1", 6);
x[0] = 2;
if (setjmp (r) == 0)
{
x[pg] = 1;
perror_exit ("test 1 no fault", 7);
}
if (munmap (x, pg) < 0)
perror_exit ("test 1 munmap 2", 8);
}
/* 2. If we map a 2-page region and unmap its first page, the second
page must remain. */
static void
test_2 ()
{
char *x = anonmap (pg * 2);
if (x == (char *)MAP_FAILED)
perror_exit ("test 2 mmap", 9);
signal (SIGSEGV, sigsegv);
if (setjmp (r))
perror_exit ("test 2 fault", 10);
x[0] = 1;
x[pg] = 1;
if (munmap (x, pg) < 0)
perror_exit ("test 2 munmap 1", 11);
x[pg] = 2;
if (setjmp (r) == 0)
{
x[0] = 1;
perror_exit ("test 2 no fault", 12);
}
if (munmap (x+pg, pg) < 0)
perror_exit ("test 2 munmap 2", 13);
}
/* 3. If we map two adjacent 1-page regions and unmap them both with
one munmap, both must go away.
Getting two adjacent 1-page regions with two mmap calls is slightly
tricky. All OS's tested skip over already-allocated blocks; therefore
we have been careful to unmap all allocated regions in previous tests.
HP/UX allocates pages backward in memory. No OS has yet been observed
to be so perverse as to leave unmapped space between consecutive calls
to mmap. */
static void
test_3 ()
{
char *x, *y, *z;
x = anonmap (pg);
if (x == (char *)MAP_FAILED)
perror_exit ("test 3 mmap 1", 14);
y = anonmap (pg);
if (y == (char *)MAP_FAILED)
perror_exit ("test 3 mmap 2", 15);
if (y != x + pg)
{
if (y == x - pg)
z = y, y = x, x = z;
else
{
fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
(unsigned long)x, (unsigned long)y);
exit (16);
}
}
signal (SIGSEGV, sigsegv);
if (setjmp (r))
perror_exit ("test 3 fault", 17);
x[0] = 1;
y[0] = 1;
if (munmap (x, pg*2) < 0)
perror_exit ("test 3 munmap", 18);
if (setjmp (r) == 0)
{
x[0] = 1;
perror_exit ("test 3 no fault 1", 19);
}
signal (SIGSEGV, sigsegv);
if (setjmp (r) == 0)
{
y[0] = 1;
perror_exit ("test 3 no fault 2", 20);
}
}
int
main ()
{
sigemptyset (&unblock_sigsegv);
sigaddset (&unblock_sigsegv, SIGSEGV);
pg = getpagesize ();
#ifndef USE_MAP_ANON
devzero = open ("/dev/zero", O_RDWR);
if (devzero < 0)
perror_exit ("open /dev/zero", 1);
#endif
test_0();
test_1();
test_2();
test_3();
exit(0);
}
EOF}}}
changequote([,])dnl
AC_CACHE_CHECK(for working mmap from /dev/zero,
ac_cv_func_mmap_dev_zero,
[AC_TRY_RUN(
[#include "ct-mmap.inc"],
ac_cv_func_mmap_dev_zero=yes,
[if test $? -lt 4
then ac_cv_func_mmap_dev_zero=no
else ac_cv_func_mmap_dev_zero=buggy
fi],
# When cross-building, assume that this works, unless we know it
# doesn't. Of course, we have no way of knowing if there even is a /dev/zero
# on the host, let alone whether mmap will work on it.
[case "$host_os" in
cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
darwin* ) ac_cv_func_mmap_dev_zero=no ;;
* ) ac_cv_func_mmap_dev_zero=yes ;;
esac])
])
if test $ac_cv_func_mmap_dev_zero = yes; then
AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
[Define if mmap can get us zeroed pages from /dev/zero.])
if test $gcc_cv_decl_map_anon = no; then
gcc_cv_func_mmap_anon=no
else
AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
gcc_cv_func_mmap_anon,
[# Add a system to this blacklist if it has mmap() and MAP_ANON or
# MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
# doesn't give anonymous zeroed pages with the same properties listed
# above for use of /dev/zero.
# Systems known to be in this category are Windows, VMS, and SCO Unix.
case "$host_os" in
vms* | cygwin* | pe | mingw* | sco* | udk* )
gcc_cv_func_mmap_anon=no ;;
*)
gcc_cv_func_mmap_anon=yes;;
esac])
fi
fi
AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
ac_cv_func_mmap_anon,
[AC_TRY_RUN(
[#define USE_MAP_ANON
#include "ct-mmap.inc"],
ac_cv_func_mmap_anon=yes,
[if test $? -lt 4
then ac_cv_func_mmap_anon=no
else ac_cv_func_mmap_anon=buggy
fi],
# Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
# just because it's there. Some SCO Un*xen define it but don't implement it.
[case "$host_os" in
darwin* ) ac_cv_func_mmap_anon=yes ;;
* ) ac_cv_func_mmap_anon=no ;;
esac])
])
if test $ac_cv_func_mmap_anon = yes; then
AC_DEFINE(HAVE_MMAP_ANON, 1,
[Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
fi
rm -f ct-mmap.inc
])
# Check whether mmap can map a plain file, without MAP_FIXED.
AC_DEFUN([AC_FUNC_MMAP_FILE],
[AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
[# Create a file one thousand bytes long.
for i in 1 2 3 4 5 6 7 8 9 0
do for j in 1 2 3 4 5 6 7 8 9 0
do echo $i $j xxxxx
done
done > conftestdata$$
AC_TRY_RUN([
/* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
Richard Henderson and Alexandre Oliva.
Check whether read-only mmap of a plain file works. */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
int main()
{
char *x;
int fd;
struct stat st;
fd = open("conftestdata$$", O_RDONLY);
if (fd < 0)
exit(1);
if (fstat (fd, &st))
exit(2);
x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (x == (char *) -1)
exit(3);
if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
exit(4);
if (munmap(x, st.st_size) < 0)
exit(5);
exit(0);
}], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
[case "$host_os" in
darwin* ) ac_cv_func_mmap_file=yes ;;
* ) ac_cv_func_mmap_file=no ;;
esac])])
if test $ac_cv_func_mmap_file = yes; then
if test $gcc_cv_func_mmap_file = yes; then
AC_DEFINE(HAVE_MMAP_FILE, 1,
[Define if read-only mmap of a plain file works.])
fi
if test $gcc_cv_func_mmap_dev_zero = yes; then
AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
[Define if mmap of /dev/zero works.])
fi
if test $gcc_cv_func_mmap_anon = yes; then
AC_DEFINE(HAVE_MMAP_ANON, 1,
[Define if mmap with MAP_ANON(YMOUS) works.])
fi
])
dnl Locate a program and check that its version is acceptable.

View File

@ -1,4 +1,4 @@
/* config.in. Generated automatically from configure.in by autoheader. */
/* config.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
@ -141,9 +141,6 @@
/* Define if you have the getgid function. */
#undef HAVE_GETGID
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
@ -168,6 +165,9 @@
/* Define if you have the mempcpy function. */
#undef HAVE_MEMPCPY
/* Define if you have the mmap function. */
#undef HAVE_MMAP
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
@ -264,6 +264,9 @@
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
@ -362,12 +365,6 @@
/* Define if valgrind's memcheck.h header is installed. */
#undef HAVE_MEMCHECK_H
/* Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects.
This is essential for fully standards-compliant handling of
destructors, but requires __cxa_atexit in libc. */
#undef DEFAULT_USE_CXA_ATEXIT
/* Define if you want the C and C++ compilers to support multibyte
character sets for source code. */
#undef MULTIBYTE_CHARS
@ -404,15 +401,15 @@
/* Define if printf supports %p. */
#undef HAVE_PRINTF_PTR
/* Define if mmap can get us zeroed pages from /dev/zero. */
#undef HAVE_MMAP_DEV_ZERO
/* Define if mmap can get us zeroed pages using MAP_ANON(YMOUS). */
#undef HAVE_MMAP_ANON
/* Define if read-only mmap of a plain file works. */
#undef HAVE_MMAP_FILE
/* Define if mmap of /dev/zero works. */
#undef HAVE_MMAP_DEV_ZERO
/* Define if mmap with MAP_ANON(YMOUS) works. */
#undef HAVE_MMAP_ANON
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
@ -527,6 +524,12 @@
/* Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h). */
#undef NEED_64BIT_HOST_WIDE_INT
/* Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects.
This is essential for fully standards-compliant handling of
destructors, but requires __cxa_atexit in libc. */
#undef DEFAULT_USE_CXA_ATEXIT
/* Define to the name of a file containing a list of extra machine modes
for this architecture. */
#undef EXTRA_MODES_FILE

922
gcc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -699,7 +699,7 @@ gcc_AC_HEADER_STDBOOL
gcc_AC_HEADER_STRING
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
fcntl.h unistd.h sys/file.h sys/time.h \
fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h \
direct.h malloc.h langinfo.h ldfcn.h wchar.h)
@ -800,7 +800,7 @@ dnl gcc_AC_C_ENUM_BF_UNSIGNED
AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
scandir alphasort gettimeofday mbstowcs wcswidth)
scandir alphasort gettimeofday mbstowcs wcswidth mmap)
if test x$ac_cv_func_mbstowcs = xyes; then
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
@ -843,6 +843,7 @@ fi
AC_SUBST(TARGET_GETGROUPS_T)
gcc_AC_FUNC_PRINTF_PTR
gcc_AC_FUNC_MMAP_BLACKLIST
case "${host}" in
*-*-uwin*)
@ -858,8 +859,6 @@ case "${host}" in
;;
esac
AC_FUNC_VFORK
AC_FUNC_MMAP_ANYWHERE
AC_FUNC_MMAP_FILE
AM_ICONV