Re: [PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
On 9/12/2010 10:20 AM, Ralf Wildenhues wrote: > I suggest you commit it so that it can be included > in the testing. Pushed as: When assigning $linklib value, honor [-all]-static[-libtool-libs] * libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs and static library exists, ensure old_library name is used as $linklib. Fixes failure on mingw when both static and shared libraries are present. --- ChangeLog |9 + libltdl/config/ltmain.m4sh | 12 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9abe8a..6b76340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-12 Charles Wilson <...> + + When assigning $linklib value, honor [-all]-static[-libtool-libs] + + * libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs + and static library exists, ensure old_library name is used as $linklib. + Fixes failure on mingw when both static and shared libraries are + present. + 2010-09-12 Ralf Wildenhues <...> tests: work around zsh use of $options variable. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 509a421..6036f4f 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5652,9 +5652,15 @@ func_mode_link () # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || +test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi -- 1.7.1
Re: [PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
On 9/12/2010 10:25 AM, Ralf Wildenhues wrote: > Also, $linklib is used for several other things. It would seem prudent > to make sure it is clear that this is a very intrusive patch, or use > another helper variable to make it less intrusive. Oh, I think linklib was *wrong* no matter what. If you requested static (either via -static, -all-static, or -static-libtool-libs), AND you have an $old_library name...then by golly you ARE going to link against that $old_library. So, when assigning $linklib, you really should take into consideration all those factors. Prior to this patch, $linklib was always set to the last element of $library_names -- and was only set to $old_library if there WERE no dynamic libs, and all you HAD was the static lib. It didn't care about the various -static options AT ALL. -- Chuck
Re: [PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
On 9/12/2010 10:20 AM, Ralf Wildenhues wrote: > Hi Charles, > > * Charles Wilson wrote on Sun, Sep 12, 2010 at 03:19:51PM CEST: >> * libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs, >> ensure old_library name is used as linklib when possible. >> --- >> This patch corrects the (long-standing?) failure of mdemo-exec.test on >> mingw, but also some non-fatal anomalies in cygwin on the same tests. >> Basically, when dlopen'ing static libraries, but when both shared and >> static libs exist, the extracted symbol names put into the >> lt__PROGRAM__LTX_preloaded_symbols array were mistakenly extracted from >> the import library instead of the static one. For PE/COFF, this makes >> a difference; and on mingw that difference caused the mdemo_static test >> to fail. > > Why does the patch have "[cygwin|mingw]" in the summary? It changes a > code path that is shared by most systems out there, no? I'd rather see > a 'Fixes foo on Cygwin and MinGW' in the details, so that when searching > the summary log later, this patch isn't mistaken for a w32-only one. OK, I'll change the summary before committing. > I think the patch is right, but this is one that *really* needs wide > range testing on several hosts. Since I'm about to tick off another > round of testing, I suggest you commit it so that it can be included > in the testing. OK. -- Chuck
Re: [PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
* Ralf Wildenhues wrote on Sun, Sep 12, 2010 at 04:20:13PM CEST: > * Charles Wilson wrote on Sun, Sep 12, 2010 at 03:19:51PM CEST: > > * libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs, > > ensure old_library name is used as linklib when possible. > Why does the patch have "[cygwin|mingw]" in the summary? It changes a > code path that is shared by most systems out there, no? I'd rather see > a 'Fixes foo on Cygwin and MinGW' in the details, so that when searching > the summary log later, this patch isn't mistaken for a w32-only one. Also, $linklib is used for several other things. It would seem prudent to make sure it is clear that this is a very intrusive patch, or use another helper variable to make it less intrusive. Cheers, Ralf
Re: [PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
Hi Charles, * Charles Wilson wrote on Sun, Sep 12, 2010 at 03:19:51PM CEST: > * libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs, > ensure old_library name is used as linklib when possible. > --- > This patch corrects the (long-standing?) failure of mdemo-exec.test on > mingw, but also some non-fatal anomalies in cygwin on the same tests. > Basically, when dlopen'ing static libraries, but when both shared and > static libs exist, the extracted symbol names put into the > lt__PROGRAM__LTX_preloaded_symbols array were mistakenly extracted from > the import library instead of the static one. For PE/COFF, this makes > a difference; and on mingw that difference caused the mdemo_static test > to fail. Why does the patch have "[cygwin|mingw]" in the summary? It changes a code path that is shared by most systems out there, no? I'd rather see a 'Fixes foo on Cygwin and MinGW' in the details, so that when searching the summary log later, this patch isn't mistaken for a w32-only one. I think the patch is right, but this is one that *really* needs wide range testing on several hosts. Since I'm about to tick off another round of testing, I suggest you commit it so that it can be included in the testing. And thanks for tracking this down! Cheers, Ralf
[PATCH] [cygwin|mingw] Correct static lib symbol extraction failure.
* libltdl/config/ltmain.m4sh (func_mode_link): When prefer_static_libs, ensure old_library name is used as linklib when possible. --- This patch corrects the (long-standing?) failure of mdemo-exec.test on mingw, but also some non-fatal anomalies in cygwin on the same tests. Basically, when dlopen'ing static libraries, but when both shared and static libs exist, the extracted symbol names put into the lt__PROGRAM__LTX_preloaded_symbols array were mistakenly extracted from the import library instead of the static one. For PE/COFF, this makes a difference; and on mingw that difference caused the mdemo_static test to fail. Test results: cygwin -- old test suite: All 122 tests passed (2 tests were not run) new test suite: 111 tests behaved as expected. 9 tests were skipped. mingw - old test suite: All 122 tests passed (2 tests were not run) new test suite: 108 tests behaved as expected. 12 tests were skipped. OK to push? -- Chuck libltdl/config/ltmain.m4sh | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index d8e0fe1..6ae2e43 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5650,9 +5650,15 @@ func_mode_link () # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || +test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi -- 1.7.1