commit:     af4893f10cca1b87433be499025bb8bf0a267b6e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  6 23:42:33 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  6 23:44:55 2025 +0000
URL:        https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=af4893f1

patches: as-needed: add 2.5.0

This stopped applying with my own 888bd7ad44fce8a2d4e9bc720c8bb8234bc10df4
(see also d3c77e47d0c2ae8806b340aabb53947012c239f5).

It showed up in media-libs/libwmf in meson's CI where ICU wasn't pulled
in as a binpkg as it was only needed via libxml2 but it being greedily
linked with -Wl,--as-needed not applying. libwmf has its own issues
fixed in git (and really needs a new release) but that's another matter,
this shows up with e.g. libwebp when modifying it to force ICU linkage
too as a random test.

Thanks-to: Eli Schwartz <eschwartz <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 patches/as-needed/2.5.0 | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/patches/as-needed/2.5.0 b/patches/as-needed/2.5.0
new file mode 100644
index 0000000..c91af6f
--- /dev/null
+++ b/patches/as-needed/2.5.0
@@ -0,0 +1,32 @@
+http://lists.gnu.org/archive/html/bug-libtool/2009-12/msg00038.html
+https://bugs.debian.org/347650
+--- ltmain.sh
++++ ltmain.sh
+@@ -7648,6 +7648,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
+@@ -8070,6 +8075,15 @@ func_mode_link ()
+       lib=
+       found=false
+       case $deplib in
++      -Wl,--as-needed|-Wl,--no-as-needed)
++        if test "$linkmode,$pass" = "prog,link"; 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

Reply via email to