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]

Avoid link tests in NPTL configure


Link tests in configure scripts are generally problematic for glibc
because when bootstrapping both the compiler and the library for a
target you don't have a pre-existing libc for them to link against.
Thus, most configure tests are compile tests, or if linker behavior
needs testing they are link tests using -nostdlib -nostartfiles and in
some cases defining _start and __start for the link (if a shared
library link does not suffice).

Among the few problem tests that do not follow those conventions are
those for forced unwind support and cleanup attributes in
nptl/sysdeps/pthread/configure - I propose this patch to fix the
problems with those tests.  We now require sufficiently recent GCC and
Binutils versions at configure time that we could pretty safely just
assume those features to be present without testing, but this patch
follows the conservative approach of changing the tests from link
tests to compile tests (removing an include of <stdio.h> from one test
since uses of headers not installed by the compiler are also
problematic in the initial bootstrap).

Tested x86_64 (native, since some more fixes are needed for proper
bootstrap testing to work cleanly).

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.  Declare puts rather than including
	<stdio.h>.
	* sysdeps/pthread/configure: Regenerated.

diff --git a/nptl/sysdeps/pthread/configure.in b/nptl/sysdeps/pthread/configure.in
index 17f18f0..8b2c841 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,8 +34,8 @@ 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([
+int puts (const char *);
 void cl (void *a) { }], [
   int a __attribute__ ((cleanup (cl)));
   puts ("test")],

-- 
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]