This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[Patch, libiberty] Fix build regression


This patch fixes a recent libiberty build regression discussed in this
thread:
  http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01998.html

If we know we aren't going to be able to build executables, simply emit
a warning saying that we can't link (instead of exiting with an error),
and mention that we're assuming prctl does not exist for this target.

Ok to commit?

AG


2010-11-19  Anthony Green  <green@moxielogic.com>

	* configure.ac: Don't run link tests if we can't build
	executables.
	* configure: Rebuilt.


Index: libiberty/configure.ac
===================================================================
--- libiberty/configure.ac	(revision 166958)
+++ libiberty/configure.ac	(working copy)
@@ -538,15 +538,20 @@
 AC_SUBST(CHECK)
 AC_SUBST(target_header_dir)
 
-# check for prctl PR_SET_NAME
-AC_LINK_IFELSE([AC_LANG_SOURCE([[
-#include <sys/prctl.h>
-int main()
-{
-  return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
-}
-]])], AC_DEFINE(HAVE_PRCTL_SET_NAME, 1,
-	[Define if you have prctl PR_SET_NAME]))
+if test x$gcc_no_link = xyes; then
+  AC_MSG_WARN([
+*** Cannot link executables.  Assuming target does not have prctl function.])
+else
+  # check for prctl PR_SET_NAME
+  AC_LINK_IFELSE([AC_LANG_SOURCE([[
+  #include <sys/prctl.h>
+  int main()
+  {
+    return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
+  }
+  ]])], AC_DEFINE(HAVE_PRCTL_SET_NAME, 1,
+  	[Define if you have prctl PR_SET_NAME]))
+fi
 
 case "${host}" in
   *-*-cygwin* | *-*-mingw*)
Index: libiberty/configure
===================================================================
--- libiberty/configure	(revision 166958)
+++ libiberty/configure	(working copy)
@@ -5719,18 +5719,24 @@
 
 
 
-# check for prctl PR_SET_NAME
 if test x$gcc_no_link = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+*** Cannot link executables.  Assuming target does not have prctl function." >&5
+$as_echo "$as_me: WARNING:
+*** Cannot link executables.  Assuming target does not have prctl function." >&2;}
+else
+  # check for prctl PR_SET_NAME
+  if test x$gcc_no_link = xyes; then
   as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
 fi
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <sys/prctl.h>
-int main()
-{
-  return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
-}
+  #include <sys/prctl.h>
+  int main()
+  {
+    return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
+  }
 
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
@@ -5740,6 +5746,7 @@
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+fi
 
 case "${host}" in
   *-*-cygwin* | *-*-mingw*)

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