This is the mail archive of the 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 for target library build failures when unable to link

Sometimes when building the compiler you cannot link while building
runtime libraries.  This is always the case on certain "generic"
targets such as powerpc-eabi (which by design do not link unless an
option such as -msim is passed); it may also arise in some compiler
bootstrap sequences.

Builds in such circumstances are currently broken in libssp and
libstdc++-v3.  The libssp breakage is P2 regression 25035; I'm not
aware of a PR for the libstdc++-v3 breakage, but it's also a

This patch fixes these build failures.  If you can't link then you
can't build shared libraries, so I think it is safe to disable symbol
versioning in this case.  The hardwired selection of available
functions for libssp is like that present for many targets in
libstdc++-v3/crossconfig.m4, and if required cases for specific
targets with mempcpy can be added in libssp.

This patch doesn't leave libssp perfect regarding cross-compilation,
since there remains an execution test for vsnprintf which should have
defaults depending on the target when cross-compiling, as many targets
will have working vsnprintf.  It does, however, fix the build failures
at least for powerpc-none-eabispe on which I tested (there may be
other libssp build failures in other configurations for other

Tested by building a cross-compiler for powerpc-none-eabispe.  OK to
commit (to mainline and 4.1 branch)?

2006-09-29  Joseph S. Myers  <>

	PR other/25035
	* (AC_EXEEXT): Remove.
	(ssp_use_symver): Default to no if unable to link.
	(AC_CHECK_FUNCS): Hardwire results if unable to link.
	* aclocal.m4, configure, Regenerate.

2006-09-29  Joseph S. Myers  <>

	* acinclude.m4 (enable_symvers): Default to no if unable to link.
	* configure: Regenerate.

Index: libstdc++-v3/acinclude.m4
--- libstdc++-v3/acinclude.m4	(revision 117274)
+++ libstdc++-v3/acinclude.m4	(working copy)
@@ -2158,7 +2158,7 @@
 # Turn a 'yes' into a suitable default.
 if test x$enable_symvers = xyes ; then
-  if test $enable_shared = no || test "x$LD" = x ; then
+  if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then
     if test $with_gnu_ld = yes ; then
Index: libssp/
--- libssp/	(revision 117274)
+++ libssp/	(working copy)
@@ -22,8 +22,9 @@
@@ -78,14 +79,27 @@
 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./"
-AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
+if test x$gcc_no_link = xyes; then
+  # If we cannot link, we cannot build shared libraries, so do not use
+  # symbol versioning.
+  ssp_use_symver=no
+  AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
 AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" = xyes])
 AC_CHECK_HEADERS(alloca.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
-AC_CHECK_FUNCS(mempcpy strncpy strncat)
+if test x$gcc_no_link = xyes; then
+  # Presume the ISO C functions are available; add target-specific
+  # configuration here if required.
+  AC_CHECK_FUNCS(mempcpy strncpy strncat)
 AC_MSG_CHECKING([whether vsnprintf is usable])

Joseph S. Myers

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