summaryrefslogtreecommitdiff
path: root/gold/configure
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-04-12 18:06:16 +0000
committerIan Lance Taylor <ian@airs.com>2011-04-12 18:06:16 +0000
commit88597d3422353743f77a4f4de1f3e790cb9f1645 (patch)
treea6b753e0fd883354777437707f2bc12e66b31474 /gold/configure
parent32a946987b2c683c06d55efc2d4d7e682f164e4e (diff)
* configure.ac: Check for sys/mman.h and mmap. Check for mremap
with MREMAP_MAYMOVE. * output.h (class Output_file): Add map_is_allocated_ field. * output.cc: Only #include <sys/mman.h> if it exists. If mmap is not available, provide stubs. If mremap is not available, #define it to gold_mremap. (MREMAP_MAYMOVE): Define if not defined. (Output_file::Output_file): Initialize map_is_allocated_. (Output_file::resize): Check map_is_allocated_. (Output_file::map_anonymous): If mmap fails, use malloc. (Output_file::unmap): Don't do anything for an anonymous map. * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap is not available, provide stubs. (File_read::View::~View): Use free rather than delete[]. (File_read::make_view): Use malloc rather than new[]. If mmap fails, use malloc. (File_read::find_or_make_view): Use malloc rather than new[]. * gold.h: Remove HAVE_REMAP code. * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it exists. Rename mremap to gold_mremap. If mmap is not available don't do anything. * configure, config.in: Rebuild.
Diffstat (limited to 'gold/configure')
-rwxr-xr-xgold/configure67
1 files changed, 62 insertions, 5 deletions
diff --git a/gold/configure b/gold/configure
index 1a0d47d03a..5a7268d349 100755
--- a/gold/configure
+++ b/gold/configure
@@ -6486,18 +6486,32 @@ WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmi
LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
-for ac_func in chsize
+for ac_header in sys/mman.h
do :
- ac_fn_c_check_func "$LINENO" "chsize" "ac_cv_func_chsize"
-if test "x$ac_cv_func_chsize" = x""yes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_mman_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_CHSIZE 1
+#define HAVE_SYS_MMAN_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in chsize mmap
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
-for ac_func in pread ftruncate mremap ffsll
+for ac_func in pread ftruncate ffsll
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -6519,6 +6533,49 @@ done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking mremap with MREMAP_MAYMOVE" >&5
+$as_echo_n "checking mremap with MREMAP_MAYMOVE... " >&6; }
+if test "${gold_cv_lib_mremap_maymove+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+#include <sys/mman.h>
+void f() { mremap (0, 0, 0, MREMAP_MAYMOVE); }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ gold_cv_lib_mremap_maymove=yes
+else
+ gold_cv_lib_mremap_maymove=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_lib_mremap_maymove" >&5
+$as_echo "$gold_cv_lib_mremap_maymove" >&6; }
+if test "$gold_cv_lib_mremap_maymove" = "yes"; then
+
+$as_echo "#define HAVE_MREMAP 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" mremap.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS mremap.$ac_objext"
+ ;;
+esac
+
+fi
+
# Link in zlib if we can. This allows us to write compressed sections.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
$as_echo_n "checking for library containing zlibVersion... " >&6; }