This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Avoid link tests in NPTL configure


On Wed, 7 Mar 2012, Roland McGrath wrote:

> That seems OK, though I would prefer that the test not explicitly declare
> and then use a standard function.  I'm not really sure why that test needs
> to have a function call after the declaration at all.  But if it does, then
> using a call to a locally-defined function or an external, undefined
> function with a nonstandard name seems better.

I think it's probably to force unwind info to be generated for the
cleanup attribute (note that this test uses -fexceptions).  I'm
testing this patch version that uses an undefined function.

2012-03-07  Joseph Myers  <joseph@codesourcery.com>

	[BZ #10545]
	* sysdeps/pthread/configure.in (libc_cv_forced_unwind): Change
	link test to a compile test.
	(libc_cv_c_cleanup): Likewise.  Use undefined function instead of
	including <stdio.h>.
	* sysdeps/pthread/configure: Regenerated.

diff --git a/nptl/sysdeps/pthread/configure.in b/nptl/sysdeps/pthread/configure.in
index 17f18f0..413af96 100644
--- a/nptl/sysdeps/pthread/configure.in
+++ b/nptl/sysdeps/pthread/configure.in
@@ -23,7 +23,7 @@ dnl Iff <unwind.h> is available, make sure it is the right one and it
 dnl contains struct _Unwind_Exception.
 AC_CACHE_CHECK(dnl
 for forced unwind support, libc_cv_forced_unwind, [dnl
-AC_TRY_LINK([#include <unwind.h>], [
+AC_TRY_COMPILE([#include <unwind.h>], [
 struct _Unwind_Exception exc;
 struct _Unwind_Context *context;
 _Unwind_GetCFA (context)],
@@ -34,11 +34,11 @@ dnl Check for C cleanup handling.
   old_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror -fexceptions"
   AC_CACHE_CHECK([for C cleanup handling], libc_cv_c_cleanup, [dnl
-  AC_TRY_LINK([
-#include <stdio.h>
+  AC_TRY_COMPILE([
+extern void some_function (void);
 void cl (void *a) { }], [
   int a __attribute__ ((cleanup (cl)));
-  puts ("test")],
+  some_function ()],
 libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
   CFLAGS="$old_CFLAGS"
   if test $libc_cv_c_cleanup = no; then

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]