Patch for target library build failures when unable to link
Joseph S. Myers
joseph@codesourcery.com
Fri Sep 29 00:45:00 GMT 2006
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
regression.
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
reasons).
Tested by building a cross-compiler for powerpc-none-eabispe. OK to
commit (to mainline and 4.1 branch)?
libssp:
2006-09-29 Joseph S. Myers <joseph@codesourcery.com>
PR other/25035
* configure.ac (AC_EXEEXT): Remove.
(GCC_NO_EXECUTABLES): Call.
(ssp_use_symver): Default to no if unable to link.
(AC_CHECK_FUNCS): Hardwire results if unable to link.
* aclocal.m4, configure, Makefile.in: Regenerate.
libstdc++-v3:
2006-09-29 Joseph S. Myers <joseph@codesourcery.com>
* 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
enable_symvers=no
else
if test $with_gnu_ld = yes ; then
Index: libssp/configure.ac
===================================================================
--- libssp/configure.ac (revision 117274)
+++ libssp/configure.ac (working copy)
@@ -22,8 +22,9 @@
AC_MSG_RESULT($version_specific_libs)
AM_MAINTAINER_MODE
-AC_EXEEXT
+GCC_NO_EXECUTABLES
+
AM_ENABLE_MULTILIB(, ..)
target_alias=${target_alias-$host_alias}
@@ -78,14 +79,27 @@
EOF
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
-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
+else
+ AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
+fi
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($ssp_use_symver)
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_DEFINE(HAVE_STRNCPY)
+ AC_DEFINE(HAVE_STRNCAT)
+else
+ AC_CHECK_FUNCS(mempcpy strncpy strncat)
+fi
AC_MSG_CHECKING([whether vsnprintf is usable])
AC_RUN_IFELSE(AC_LANG_PROGRAM([
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libstdc++
mailing list