libstdc++ tries to avoid link tests when configured with newlib. But I
saw this when working on bfin port gcc:

checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/home/jie/blackfin-sources/build43/gcc_build-4.3'
make: *** [all] Error 2

I got this when building bfin-elf-gcc with patched gcc and newlib in the
same tree. I found LT_SYS_DLOPEN_SELF does link tests for shl_load after
GCC_NO_EXECUTABLES. The call path is

"libstdc++-v3/configure.ac" AM_PROG_LIBTOOL -> "libtool.m4" LT_INIT ->
_LT_SETUP -> _LT_LANG_C_CONFIG -> LT_SYS_DLOPEN_SELF

How about the patch below, which uses LT_SYS_DLOPEN_SELF only when not
cross compiling.


Jie


        * libtool.m4 (_LT_LANG_C_CONFIG): Only use LT_SYS_DLOPEN_SELF
        when not cross compiling.

Index: libtool.m4
===================================================================
--- libtool.m4  (revision 128569)
+++ libtool.m4  (working copy)
@@ -5117,7 +5117,9 @@
   _LT_LINKER_SHLIBS($1)
   _LT_SYS_DYNAMIC_LINKER($1)
   _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
+  if test "$cross_compiling" = no; then
+    LT_SYS_DLOPEN_SELF
+  fi
   _LT_CMD_STRIPLIB

   # Report which library types will actually be built


Reply via email to