diff options
author | John David Anglin <danglin@gcc.gnu.org> | 2025-01-27 12:39:00 -0500 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2025-01-27 12:39:00 -0500 |
commit | 9d450dee7112635a541c5a34268d54f63da48f71 (patch) | |
tree | 41a677c3600f0fda4355864d182d0a56e0d5c46b /gcc | |
parent | d31667e8488ad2b14ae4ee6d128ae0015381fbef (diff) | |
download | gcc-9d450dee7112635a541c5a34268d54f63da48f71.zip gcc-9d450dee7112635a541c5a34268d54f63da48f71.tar.gz gcc-9d450dee7112635a541c5a34268d54f63da48f71.tar.bz2 |
c++: Use mapped reads and writes when munmap and msync are available
Module support is broken when MAPPED_READING and MAPPED_WRITING
are defined to 0. This causes internal compiler errors in the
permissive-error-1.C and permissive-error-2.C tests.
HP-UX 11.11 doesn't define _POSIX_MAPPED_FILES but it does have
munmap and msync. Testing indicates support is sufficient for
c++ modules, so use checks for these functions instead of
_POSIX_MAPPED_FILES check.
2025-01-27 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
PR c++/116524
* configure.ac: Check for munmap and msync.
* configure: Regenerate.
* config.in: Regenerate.
gcc/cp/ChangeLog:
* module.cc: Test HAVE_MUNMAP and HAVE_MSYNC instead of
_POSIX_MAPPED_FILES > 0.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.in | 12 | ||||
-rwxr-xr-x | gcc/configure | 2 | ||||
-rw-r--r-- | gcc/configure.ac | 2 | ||||
-rw-r--r-- | gcc/cp/module.cc | 6 |
4 files changed, 17 insertions, 5 deletions
diff --git a/gcc/config.in b/gcc/config.in index 44de5a5..3b06533 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1972,6 +1972,18 @@ #endif +/* Define to 1 if you have the `msync' function. */ +#ifndef USED_FOR_TARGET +#undef HAVE_MSYNC +#endif + + +/* Define to 1 if you have the `munmap' function. */ +#ifndef USED_FOR_TARGET +#undef HAVE_MUNMAP +#endif + + /* Define if GCC has been configured with --enable-newlib-nano-formatted-io. */ #ifndef USED_FOR_TARGET diff --git a/gcc/configure b/gcc/configure index b4c52de..e36d1d9 100755 --- a/gcc/configure +++ b/gcc/configure @@ -10637,7 +10637,7 @@ for ac_func in times clock kill getrlimit setrlimit atoq \ popen sysconf strsignal getrusage nl_langinfo \ gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \ clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 fstatat getauxval \ - clock_gettime + clock_gettime munmap msync do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gcc/configure.ac b/gcc/configure.ac index 6c38c49..8fab93c 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1574,7 +1574,7 @@ AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \ popen sysconf strsignal getrusage nl_langinfo \ gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \ gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval \ - clock_gettime) + clock_gettime munmap msync) # At least for glibc, clock_gettime is in librt. But don't pull that # in if it still doesn't give us the function we want. diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 312ff66..59716e1 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -241,11 +241,11 @@ Classes used: #define MAPPED_READING 0 #define MAPPED_WRITING 0 #else -#if HAVE_MMAP_FILE && _POSIX_MAPPED_FILES > 0 -/* mmap, munmap. */ +#if HAVE_MMAP_FILE && HAVE_MUNMAP && HAVE_MSYNC +/* mmap, munmap, msync. */ #define MAPPED_READING 1 #if HAVE_SYSCONF && defined (_SC_PAGE_SIZE) -/* msync, sysconf (_SC_PAGE_SIZE), ftruncate */ +/* sysconf (_SC_PAGE_SIZE), ftruncate */ /* posix_fallocate used if available. */ #define MAPPED_WRITING 1 #else |