On Tue, Jul 13, 2010 at 5:24 PM, Don Maghrak <[email protected]> wrote:
>
> Is there a way to have configure ensure that mincore is only
> used at linux 2.6.21 or later?
> For now we are undefining HAVE_MINCORE in our builds but that makes
> deployment on multiple systems difficult.

A runtime check is probably too expensive. A compile time check fails
if you compile on a new kernel and deploy on an old kernel.

The attached patch should allow you to turn off HAVE_MINCORE via a
configure time flag.

 -Arun
diff --git a/configure.in b/configure.in
index 8e2d138..ae68370 100644
--- a/configure.in
+++ b/configure.in
@@ -76,7 +76,7 @@ dnl Checks for library functions.
 AC_FUNC_MEMCMP
 AC_TYPE_SIGNAL
 AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \
-		ttrace mincore)
+		ttrace)
 is_gcc_m64() {
  if test `echo $CFLAGS | grep "\-m64" -c` -eq 1 ; then echo ppc64;
  else
@@ -173,7 +173,16 @@ AC_ARG_ENABLE(conservative_checks,
 [ --enable-conservative-checks Validate all memory addresses before use],
 [enable_conservative_checks=$enableval], [enable_conservative_checks=yes])
 if test x$enable_conservative_checks = xyes; then
-  CPPFLAGS="${CPPFLAGS} -DCONSERVATIVE_CHECKS"
+  AC_DEFINE(CONSERVATIVE_CHECKS, 1,
+	[Define to 1 if you want every memory access validated])
+fi
+
+AC_ARG_ENABLE(mincore,
+[  --enable-mincore  Use mincore(2) for validating that memory is readable],
+[enable_mincore=$enableval], [])
+if test x$enable_mincore = xyes; then
+  AC_DEFINE(HAVE_MINCORE, 1,
+	[Define to 1 if you want to use mincore(2) for validation])
 fi
 
 LIBUNWIND___THREAD
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to