When testing libmudflap on Solaris 8, 9, and 10 with GNU ld, I found a couple of testsuite failures:
* On Solaris 10, several libmudflap.cth tests fail with FAIL: libmudflap.cth/pass37-frag.c (test for excess errors) Excess errors: /vol/gcc/src/hg/trunk/local/libmudflap/testsuite/libmudflap.cth/pass37-frag.c:23 : undefined reference to `sched_yield' Before Solaris 11, one needs -lrt for sched_yield. * On Solaris 9 (which, unlike Solaris 10+, still provides a static libc), many -static tests fail: FAIL: libmudflap.c/fail1-frag.c (-static) (test for excess errors) Excess errors: /vol/gcc/bin/gld-2.21.1: cannot find -ldl collect2: error: ld returned 1 exit status There is no static libdl, of course, and it seems to be unnecessary in the testsuite anyway. In theory, one could avoid adding it to mfconfig.exp (mfconfig_libs), but that complexity is probably unwarranted for the following. * There is no static librt, so all -static tests fail for that reason. Again, one could think about only adding it for the tests that need it, but given that linking statically against system libraries is heavily frowned upon even in Solaris 8/9, I decided against it. Instead, I chose to add mfconfig_libs to the -static check in libmudflap-init, which disables them completely for Solaris. * Not a testsuite issue, but the pth directory is now completely unused/unnecessary, so I don't create it. With this patch, all libmudflap tests (with the exception of 64-bit libmudflap.c++/pass55-frag.cxx) pass on i386-pc-solaris2.11, i386-pc-solaris2.8, sparc-sun-solaris2.8, and x86_64-unknown-linux-gnu. Ok for mainline? Rainer 2011-07-08 Rainer Orth <r...@cebitec.uni-bielefeld.de> * configure.ac: Don't create pth. Check for library containing sched_yield. * configure: Regenerate. * config.h.in: Regenerate. * testsuite/lib/libmudflap.exp (libmudflap-init): Use mfconfig_libs in -static check. diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac --- a/libmudflap/configure.ac +++ b/libmudflap/configure.ac @@ -112,12 +112,6 @@ else fi AC_SUBST(MF_HAVE_UINTPTR_T) -if test ! -d pth -then - # libmudflapth objects are built in this subdirectory - mkdir pth -fi - AC_CHECK_HEADERS(pthread.h) AC_MSG_CHECKING([for thread model used by GCC]) @@ -150,6 +144,7 @@ AC_SUBST(build_libmudflapth) AC_CHECK_LIB(dl, dlsym) AC_CHECK_FUNC(connect,, AC_CHECK_LIB(socket, connect)) +AC_CHECK_FUNC(sched_yield,, AC_CHECK_LIB(rt, sched_yield)) # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp --- a/libmudflap/testsuite/lib/libmudflap.exp +++ b/libmudflap/testsuite/lib/libmudflap.exp @@ -124,9 +124,11 @@ proc libmudflap-init { language } { # If there is no static library then don't run tests with -static. global tool + global mfconfig_libs set opts "additional_flags=-static" lappend opts "additional_flags=-fmudflap" lappend opts "additional_flags=-lmudflap" + lappend opts "libs=$mfconfig_libs" set src stlm[pid].c set exe stlm[pid].x -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University