From: Pierre Ossman Date: Tue, 1 Apr 2025 13:44:51 +0000 (+0300) Subject: ltmain.in: Fix reordering --as-needed X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3fce3d4e8d50cb151baf5e233367e9528da58697;p=thirdparty%2Flibtool.git ltmain.in: Fix reordering --as-needed Libtool was reordering flags like, --as-needed, which broke its usage, since the relevant libraries were no longer following the flag. Reported: https://savannah.gnu.org/support/?111213 * build-aux/ltmain.in: Add check for --as-needed and --no-as-needed flags. --- diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 1417745cf..294ed43c3 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -5580,6 +5580,11 @@ func_mode_link () arg=$func_stripname_result ;; + -Wl,--as-needed|-Wl,--no-as-needed) + deplibs="$deplibs $arg" + continue + ;; + -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result @@ -6008,6 +6013,15 @@ func_mode_link () lib= found=false case $deplib in + -Wl,--as-needed|-Wl,--no-as-needed) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then