summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile5
-rw-r--r--eltpatch.in29
-rw-r--r--patches/color-record/2.4.229
-rw-r--r--patches/color-record/2.4.631
-rw-r--r--patches/color-record/2.4.6-alt28
-rw-r--r--patches/color-record/2.4.735
-rw-r--r--patches/color-record/2.4.7-debian40
-rw-r--r--patches/cxx-pthread/2.4.639
-rw-r--r--patches/darwin20-conf/2.2.716
-rw-r--r--patches/darwin20-conf/2.4.616
-rw-r--r--patches/darwin20-conf/2.4.6-alt16
-rw-r--r--patches/fsanitize/2.4.235
-rw-r--r--patches/fsanitize/2.4.639
-rw-r--r--patches/fuse-ld/2.4.234
-rw-r--r--patches/fuse-ld/2.4.638
-rw-r--r--patches/g-debug/2.4.229
-rw-r--r--patches/openmp/2.4.636
-rw-r--r--patches/openmp/2.4.736
-rw-r--r--patches/sed-quote/2.4.6128
-rw-r--r--patches/specs/2.4.230
-rw-r--r--patches/specs/2.4.631
-rw-r--r--patches/static-flags/2.4.638
-rw-r--r--patches/verbose-pic/2.4.739
-rw-r--r--patches/werror/1.3134-2.2.7a-gnu57
-rw-r--r--patches/werror/2.4.228
-rw-r--r--patches/werror/2.4.630
-rw-r--r--patches/werror/2.4.732
-rw-r--r--patches/werror/2.4.7-debian34
-rw-r--r--tests/.gitignore8
-rw-r--r--tests/2.4.6/configure.ac4
-rw-r--r--tests/2.4.7/configure.ac4
-rw-r--r--tests/README.md7
-rwxr-xr-xtests/run.sh31
-rwxr-xr-xtests/setup.sh62
35 files changed, 1090 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..728412a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*~
+
+/eltpatch
diff --git a/Makefile b/Makefile
index 90ddc87..badd60b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
DESTDIR =
@@ -26,6 +26,9 @@ eltpatch: eltpatch.in
clean:
rm -f eltpatch
+check: eltpatch
+ cd tests && ./setup.sh && ./run.sh
+
install-bin: eltpatch
install -d $(DESTDIR)$(bindir)
install -m0755 $< $(DESTDIR)$(bindir)
diff --git a/eltpatch.in b/eltpatch.in
index 6b69216..8c6daee 100644
--- a/eltpatch.in
+++ b/eltpatch.in
@@ -7,6 +7,8 @@ type -P gfind &>/dev/null && FIND=gfind || FIND=find
type -P gpatch &>/dev/null && PATCH=gpatch || PATCH=patch
type -P gsed &>/dev/null && SED=gsed || SED=sed
+: "${ELT_patchdir:=@ELT_patchdir@}"
+
source "@ELT_gentoofuncs@" || exit 1
die() {
@@ -74,7 +76,7 @@ ELT_walk_patches() {
local ret=1
local file=$1
local patch_set=$2
- local patch_dir="@ELT_patchdir@/${patch_set}"
+ local patch_dir="${ELT_patchdir}/${patch_set}"
local rem_int_dep=$3
[[ -z ${patch_set} ]] && return 1
@@ -88,7 +90,7 @@ ELT_walk_patches() {
sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
fi
- pushd "@ELT_patchdir@" >/dev/null || die "pushd to elt-patch dir failed"
+ pushd "${ELT_patchdir}" >/dev/null || die "pushd to elt-patch dir failed"
# Go through the patches in reverse order (newer version to older)
for patch in $(${FIND} "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
@@ -125,7 +127,10 @@ elibtoolize() {
local deptoremove=
local do_shallow="no"
local force="false"
- local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm ppc64le"
+ local elt_patches="
+ install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm ppc64le
+ g-debug specs fsanitize fuse-ld static-flags werror cxx-pthread color-record sed-quote openmp verbose-pic
+ "
for x in "$@" ; do
case ${x} in
@@ -173,13 +178,13 @@ elibtoolize() {
case ${CHOST} in
*-aix*) elt_patches+=" hardcode aixrtl" ;; #213277
- *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf" ;;
+ *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf darwin20-conf" ;;
*-solaris*) elt_patches+=" sol2-conf sol2-ltmain" ;;
*-freebsd*) elt_patches+=" fbsd-conf fbsd-ltconf" ;;
*-hpux*) elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;;
*-irix*) elt_patches+=" irix-ltmain" ;;
*-mint*) elt_patches+=" mint-conf" ;;
- *-winnt*) elt_patches+=" winnt-conf winnt-ltmain" ;;
+ *-winnt*) elt_patches+=" winnt-ltmain winnt-conf" ;;
esac
if ${LD} --version 2>&1 | grep -qs 'GNU gold'; then
@@ -286,6 +291,18 @@ elibtoolize() {
ret=$?
fi
;;
+ winnt-ltmain)
+ local version=$(ELT_libtool_version "${d}/ltmain.sh")
+ case ${version} in
+ 2.4.6 | 2.4.6[' .']* )
+ ELT_walk_patches "${d}/ltmain.sh" "${p}"
+ ret=$?
+ ;;
+ *)
+ die "${p}: need libtool 2.4.6+ (not ${version}) in ${d}"
+ ;;
+ esac
+ ;;
*)
ELT_walk_patches "${d}/ltmain.sh" "${p}"
ret=$?
@@ -388,7 +405,7 @@ elibtoolize() {
fi
done
;;
- mint-conf|gold-conf|sol2-conf)
+ mint-conf|gold-conf|sol2-conf|darwin20-conf)
ELT_walk_patches "${d}/configure" "${p}"
ret=$?
;;
diff --git a/patches/color-record/2.4.2 b/patches/color-record/2.4.2
new file mode 100644
index 0000000..9647592
--- /dev/null
+++ b/patches/color-record/2.4.2
@@ -0,0 +1,29 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-01/msg00029.html
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=533d816dea307ad78c4e7ba16dcdec4c285b0bc8
+
+From 533d816dea307ad78c4e7ba16dcdec4c285b0bc8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 14 Jan 2024 06:27:33 +0000
+Subject: ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
+
+* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
+ makes the link phase stick out like a sore thumb if there's warnings emitted.
+
+* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
+ *FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
+ here as -g* is already whitelisted.
+
+* build-aux/ltmain.in: Handle -fdiagnostics-color* & -frecord-gcc-switches.
+--- ltmain.in
++++ ltmain.in
+@@ -5363,7 +5363,8 @@ func_mode_link ()
+ # -stdlib=* select c++ std lib with clang
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin| \
+- -specs=*|-fsanitize=*|-fuse-ld=*|-Werror|-Werror=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-Werror|-Werror=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/color-record/2.4.6 b/patches/color-record/2.4.6
new file mode 100644
index 0000000..acad694
--- /dev/null
+++ b/patches/color-record/2.4.6
@@ -0,0 +1,31 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-01/msg00029.html
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=533d816dea307ad78c4e7ba16dcdec4c285b0bc8
+
+From 533d816dea307ad78c4e7ba16dcdec4c285b0bc8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 14 Jan 2024 06:27:33 +0000
+Subject: ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
+
+* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
+ makes the link phase stick out like a sore thumb if there's warnings emitted.
+
+* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
+ *FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
+ here as -g* is already whitelisted.
+
+* build-aux/ltmain.in: Handle -fdiagnostics-color* & -frecord-gcc-switches.
+--- ltmain.in
++++ ltmain.in
+@@ -5363,7 +5363,8 @@ func_mode_link ()
+ # -stdlib=* select c++ std lib with clang
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
+--
+2.43.0
+
diff --git a/patches/color-record/2.4.6-alt b/patches/color-record/2.4.6-alt
new file mode 100644
index 0000000..e036aa1
--- /dev/null
+++ b/patches/color-record/2.4.6-alt
@@ -0,0 +1,28 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-01/msg00029.html
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=533d816dea307ad78c4e7ba16dcdec4c285b0bc8
+
+From 533d816dea307ad78c4e7ba16dcdec4c285b0bc8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 14 Jan 2024 06:27:33 +0000
+Subject: ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
+
+* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
+ makes the link phase stick out like a sore thumb if there's warnings emitted.
+
+* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
+ *FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
+ here as -g* is already whitelisted.
+
+* build-aux/ltmain.in: Handle -fdiagnostics-color* & -frecord-gcc-switches.
+--- ltmain.sh
++++ ltmain.sh
+@@ -7304,7 +7304,8 @@
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Werror|-Werror=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Werror|-Werror=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
diff --git a/patches/color-record/2.4.7 b/patches/color-record/2.4.7
new file mode 100644
index 0000000..9baae3d
--- /dev/null
+++ b/patches/color-record/2.4.7
@@ -0,0 +1,35 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-01/msg00029.html
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=533d816dea307ad78c4e7ba16dcdec4c285b0bc8
+
+From 533d816dea307ad78c4e7ba16dcdec4c285b0bc8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 14 Jan 2024 06:27:33 +0000
+Subject: ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
+
+* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
+ makes the link phase stick out like a sore thumb if there's warnings emitted.
+
+* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
+ *FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
+ here as -g* is already whitelisted.
+
+* build-aux/ltmain.in: Handle -fdiagnostics-color* & -frecord-gcc-switches.
+--- ltmain.in
++++ ltmain.in
+@@ -5405,6 +5405,8 @@ func_mode_link ()
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ # -specs=* GCC specs files
+ # -stdlib=* select c++ std lib with clang
++ # -fdiagnostics-color* simply affects output
++ # -frecord-gcc-switches used to verify flags were respected
+ # -fsanitize=* Clang/GCC memory and address sanitizer
+ # -fuse-ld=* Linker select flags for GCC
+ # -Wa,* Pass flags directly to the assembler
+@@ -5412,6 +5414,7 @@ func_mode_link ()
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches| \
+ -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*|-Werror|-Werror=*)
+ func_quote_arg pretty "$arg"
+ arg=$func_quote_arg_result
diff --git a/patches/color-record/2.4.7-debian b/patches/color-record/2.4.7-debian
new file mode 100644
index 0000000..562cc98
--- /dev/null
+++ b/patches/color-record/2.4.7-debian
@@ -0,0 +1,40 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-01/msg00029.html
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=533d816dea307ad78c4e7ba16dcdec4c285b0bc8
+
+From 50f97756e75da06269374fff455cb211c7cf5cda Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 14 Jan 2024 06:27:33 +0000
+Subject: ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
+
+* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
+ makes the link phase stick out like a sore thumb if there's warnings emitted.
+
+* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
+ *FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
+ here as -g* is already whitelisted.
+
+* build-aux/ltmain.in: Handle -fdiagnostics-color* & -frecord-gcc-switches.
+
+[rebased on top of Debian ltmain.sh]
+Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
+--- ltmain.in
++++ ltmain.in
+@@ -7559,6 +7559,8 @@ func_mode_link ()
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ # -specs=* GCC specs files
+ # -stdlib=* select c++ std lib with clang
++ # -fdiagnostics-color* simply affects output
++ # -frecord-gcc-switches used to verify flags were respected
+ # -fsanitize=* Clang/GCC memory and address sanitizer
+ # -fuse-ld=* Linker select flags for GCC
+ # -static-* direct GCC to link specific libraries statically
+@@ -7568,6 +7570,7 @@ func_mode_link ()
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches| \
+ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*)
+ func_quote_arg pretty "$arg"
+ arg=$func_quote_arg_result
+--
+2.43.0
diff --git a/patches/cxx-pthread/2.4.6 b/patches/cxx-pthread/2.4.6
new file mode 100644
index 0000000..16ba6b2
--- /dev/null
+++ b/patches/cxx-pthread/2.4.6
@@ -0,0 +1,39 @@
+http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/11704
+https://debbugs.gnu.org/15646
+https://bugs.gentoo.org/650876
+
+From: Pavel Raiskup <praiskup <at> redhat.com>
+Subject: [PATCH] libtool: handle the -pthread{,s} options for g++
+Newsgroups: gmane.comp.gnu.libtool.patches
+Date: Thursday 28th November 2013 14:18:05 UTC (over 4 years ago)
+
+As we are forced to pass -nostdlib to g++ for linking, this option
+expectedly disables the effectiveness of passed -pthread flag - so
+add the -lpthread explicitly to $deplibs to link correctly.
+
+References:
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
+https://bugzilla.redhat.com/show_bug.cgi?id=661333
+http://lists.gnu.org/archive/html/bug-libtool/2013-01/msg00018.htm
+
+* build-aux/ltmain.in (func_mode_link): Explicitly add -lpthread
+flag into $deplibs when -pthread is passed (for g++ only).
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -7127,6 +7127,16 @@
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
++
++ # As we are forced to pass -nostdlib to g++ during linking, the option
++ # -pthread{,s} is not in effect; add the -lpthread to $deplist
++ # explicitly to link correctly.
++ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
++ case "$arg" in
++ -pthread*) func_append deplibs " -lpthread" ;;
++ esac
++ fi
++
+ continue
+ ;;
+
diff --git a/patches/darwin20-conf/2.2.7 b/patches/darwin20-conf/2.2.7
new file mode 100644
index 0000000..3af0b29
--- /dev/null
+++ b/patches/darwin20-conf/2.2.7
@@ -0,0 +1,16 @@
+https://bugs.gnu.org/44605
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=9e8c882517082fe5755f2524d23efb02f1522490
+
+macOS Big Sur is 11.0, Darwin 20, after a long line of 10.X releases.
+macOS Monterey is 12.0.
+--- configure
++++ configure
+@@ -8121,7 +8121,7 @@
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012][,.]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+- 10.*)
++ 1[0-9].*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
diff --git a/patches/darwin20-conf/2.4.6 b/patches/darwin20-conf/2.4.6
new file mode 100644
index 0000000..4eb08ff
--- /dev/null
+++ b/patches/darwin20-conf/2.4.6
@@ -0,0 +1,16 @@
+https://bugs.gnu.org/44605
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=9e8c882517082fe5755f2524d23efb02f1522490
+
+macOS Big Sur is 11.0, Darwin 20, after a long line of 10.X releases.
+macOS Monterey is 12.0.
+--- configure
++++ configure
+@@ -1076,7 +1076,7 @@
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]][[,.]]*)
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+- 10.*)
++ 1[0-9].*)
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
diff --git a/patches/darwin20-conf/2.4.6-alt b/patches/darwin20-conf/2.4.6-alt
new file mode 100644
index 0000000..1e819ab
--- /dev/null
+++ b/patches/darwin20-conf/2.4.6-alt
@@ -0,0 +1,16 @@
+https://bugs.gnu.org/44605
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=9e8c882517082fe5755f2524d23efb02f1522490
+
+macOS Big Sur is 11.0, Darwin 20, after a long line of 10.X releases.
+macOS Monterey is 12.0.
+--- configure
++++ configure
+@@ -8949,7 +8949,7 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; }
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+ 10.[012][,.]*)
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+- 10.*|11.*)
++ 1[0-9].*)
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
diff --git a/patches/fsanitize/2.4.2 b/patches/fsanitize/2.4.2
new file mode 100644
index 0000000..6374dca
--- /dev/null
+++ b/patches/fsanitize/2.4.2
@@ -0,0 +1,35 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=a5c6466528c060cc4660ad0319c00740db0e42ba
+
+From a5c6466528c060cc4660ad0319c00740db0e42ba Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
+Date: Sun, 18 Oct 2015 21:55:39 -0700
+Subject: [PATCH] libtool: fix GCC/clang linking with -fsanitize=*
+
+References:
+https://lists.gnu.org/archive/html/libtool/2014-04/msg00026.html
+
+* build-aux/ltmain.in (func_mode_link): Pass -fsanitize=* to the
+linker to allow trivial use of the clang address sanitizer.
+
+Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
+Copyright-paperwork-exempt: Yes
+---
+ build-aux/ltmain.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 1cbe875dfd86..2a5aaadd68c0 100644
+--- ltmain.sh
++++ ltmain.sh
+@@ -5382,10 +5382,11 @@ func_mode_link ()
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ # -specs=* GCC specs files
++ # -fsanitize=* Clang/GCC memory and address sanitizer
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin| \
+- -specs=*)
++ -specs=*|-fsanitize=*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/fsanitize/2.4.6 b/patches/fsanitize/2.4.6
new file mode 100644
index 0000000..853355b
--- /dev/null
+++ b/patches/fsanitize/2.4.6
@@ -0,0 +1,39 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=a5c6466528c060cc4660ad0319c00740db0e42ba
+
+From a5c6466528c060cc4660ad0319c00740db0e42ba Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
+Date: Sun, 18 Oct 2015 21:55:39 -0700
+Subject: [PATCH] libtool: fix GCC/clang linking with -fsanitize=*
+
+References:
+https://lists.gnu.org/archive/html/libtool/2014-04/msg00026.html
+
+* build-aux/ltmain.in (func_mode_link): Pass -fsanitize=* to the
+linker to allow trivial use of the clang address sanitizer.
+
+Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
+Copyright-paperwork-exempt: Yes
+---
+ build-aux/ltmain.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 1cbe875dfd86..2a5aaadd68c0 100644
+--- ltmain.sh
++++ ltmain.sh
+@@ -5382,10 +5382,11 @@ func_mode_link ()
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ # -specs=* GCC specs files
+ # -stdlib=* select c++ std lib with clang
++ # -fsanitize=* Clang/GCC memory and address sanitizer
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*)
++ -specs=*|-fsanitize=*)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
+--
+2.33.0
+
diff --git a/patches/fuse-ld/2.4.2 b/patches/fuse-ld/2.4.2
new file mode 100644
index 0000000..c6af7f2
--- /dev/null
+++ b/patches/fuse-ld/2.4.2
@@ -0,0 +1,34 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=f9970d99293faf908fdc153a653fa5781095fb7a
+
+From f9970d99293faf908fdc153a653fa5781095fb7a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 13 Feb 2016 02:14:29 -0500
+Subject: [PATCH] libtool: pass through -fuse-ld flags
+
+Starting with gcc-4.8, there's a -fuse-ld flag that can be used to
+select between bfd & gold. Make sure we pass it through to the
+linking stage.
+
+* build-aux/ltmain.in (func_mode_link): Pass -fuse-ld=* flags
+through.
+Copyright-paperwork-exempt: Yes
+---
+ build-aux/ltmain.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 40eb0297f37d..26015641925e 100644
+--- ltmain.sh
++++ ltmain.sh
+@@ -5383,10 +5383,11 @@ func_mode_link ()
+ # -specs=* GCC specs files
+ # -fsanitize=* Clang/GCC memory and address sanitizer
++ # -fuse-ld=* Linker select flags for GCC
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin| \
+- -specs=*|-fsanitize=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/fuse-ld/2.4.6 b/patches/fuse-ld/2.4.6
new file mode 100644
index 0000000..907caa4
--- /dev/null
+++ b/patches/fuse-ld/2.4.6
@@ -0,0 +1,38 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=f9970d99293faf908fdc153a653fa5781095fb7a
+
+From f9970d99293faf908fdc153a653fa5781095fb7a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 13 Feb 2016 02:14:29 -0500
+Subject: [PATCH] libtool: pass through -fuse-ld flags
+
+Starting with gcc-4.8, there's a -fuse-ld flag that can be used to
+select between bfd & gold. Make sure we pass it through to the
+linking stage.
+
+* build-aux/ltmain.in (func_mode_link): Pass -fuse-ld=* flags
+through.
+Copyright-paperwork-exempt: Yes
+---
+ build-aux/ltmain.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 40eb0297f37d..26015641925e 100644
+--- ltmain.sh
++++ ltmain.sh
+@@ -5383,10 +5383,11 @@ func_mode_link ()
+ # -specs=* GCC specs files
+ # -stdlib=* select c++ std lib with clang
+ # -fsanitize=* Clang/GCC memory and address sanitizer
++ # -fuse-ld=* Linker select flags for GCC
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
+--
+2.33.0
+
diff --git a/patches/g-debug/2.4.2 b/patches/g-debug/2.4.2
new file mode 100644
index 0000000..afc7776
--- /dev/null
+++ b/patches/g-debug/2.4.2
@@ -0,0 +1,29 @@
+From 9b726f35db98da01a7edaf143788cba2c2ae900a Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@linux-m68k.org>
+Date: Tue, 21 Aug 2012 20:17:04 -0500
+Subject: [PATCH] Pass through -g* so that debugging information is not dropped
+
+* ltmain.m4sh (func_mode_link): Pass through -g*.
+
+Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
+---
+ build-aux/ltmain.m4sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
+index 48e259b6..1d71f0e2 100644
+--- a/build-aux/ltmain.m4sh
++++ b/build-aux/ltmain.m4sh
+@@ -5090,11 +5090,11 @@ func_mode_link ()
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+- # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
++ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/openmp/2.4.6 b/patches/openmp/2.4.6
new file mode 100644
index 0000000..dca6110
--- /dev/null
+++ b/patches/openmp/2.4.6
@@ -0,0 +1,36 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-03/msg00003.html
+https://bugs.gentoo.org/740310
+
+From cbe0f31e92142b624da92487ceed6b95e948f726 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 24 Mar 2024 08:24:30 +0000
+Subject: [PATCH] ltmain.in: Pass through -fopenmp=*
+
+Clang uses -fopenmp=* to allow choosing between libgomp and libomp.
+
+* build-aux/ltmain.in: Pass through -fopenmp=*.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/build-aux/ltmain.in
++++ b/build-aux/ltmain.in
+@@ -5159,7 +5159,7 @@ func_mode_link ()
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
++ |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+@@ -5693,7 +5693,7 @@ func_mode_link ()
+ found=false
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
++ |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test prog,link = "$linkmode,$pass"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+--
+2.44.0
+
diff --git a/patches/openmp/2.4.7 b/patches/openmp/2.4.7
new file mode 100644
index 0000000..9aa171b
--- /dev/null
+++ b/patches/openmp/2.4.7
@@ -0,0 +1,36 @@
+https://lists.gnu.org/archive/html/libtool-patches/2024-03/msg00003.html
+https://bugs.gentoo.org/740310
+
+From c3e479801e530f86c37a5598e3ec8e910b957cd2 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 24 Mar 2024 08:24:30 +0000
+Subject: [PATCH] ltmain.in: Pass through -fopenmp=*
+
+Clang uses -fopenmp=* to allow choosing between libgomp and libomp.
+
+* build-aux/ltmain.in: Pass through -fopenmp=*.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/build-aux/ltmain.in
++++ b/build-aux/ltmain.in
+@@ -5198,7 +5198,7 @@ func_mode_link ()
+ continue
+ ;;
+ -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
+- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
++ |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+@@ -5755,7 +5755,7 @@ func_mode_link ()
+ found=false
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
++ |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test prog,link = "$linkmode,$pass"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+--
+2.44.0
+
diff --git a/patches/sed-quote/2.4.6 b/patches/sed-quote/2.4.6
new file mode 100644
index 0000000..073e40e
--- /dev/null
+++ b/patches/sed-quote/2.4.6
@@ -0,0 +1,128 @@
+https://harald.hoyer.xyz/2015/03/05/libtool-getting-rid-of-180000-sed-forks/
+https://bugs.gnu.org/20006
+https://bugs.gentoo.org/542252
+
+From 32f0df9835ac15ac17e04be57c368172c3ad1d19 Mon Sep 17 00:00:00 2001
+From: Pavel Raiskup <praiskup@redhat.com>
+Date: Sun, 4 Oct 2015 21:55:03 +0200
+Subject: [PATCH] libtool: mitigate the $sed_quote_subst slowdown
+
+When it is reasonably possible, use shell implementation for
+quoting.
+
+References:
+http://lists.gnu.org/archive/html/libtool/2015-03/msg00005.html
+http://lists.gnu.org/archive/html/libtool/2015-02/msg00000.html
+https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20006
+
+* ltmain.in (func_emit_wrapper): Use func_quote instead
+of '$SED $sed_quote_subst'.
+(func_mode_link): Likewise.
+--- ltmain.sh
++++ ltmain.sh
+@@ -1026,6 +1026,57 @@ func_relative_path ()
+ }
+
+
++# func_quote ARG
++# --------------
++# Aesthetically quote one ARG, store the result into $func_quote_result. Note
++# that we keep attention to performance here (so far O(N) complexity as long as
++# func_append is O(1)).
++func_quote ()
++{
++ $debug_cmd
++
++ func_quote_result=$1
++
++ case $func_quote_result in
++ *[\\\`\"\$]*)
++ case $func_quote_result in
++ *[\[\*\?]*)
++ func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"`
++ return 0
++ ;;
++ esac
++
++ func_quote_old_IFS=$IFS
++ for _G_char in '\' '`' '"' '$'
++ do
++ # STATE($1) PREV($2) SEPARATOR($3)
++ set start "" ""
++ func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy
++ IFS=$_G_char
++ for _G_part in $func_quote_result
++ do
++ case $1 in
++ quote)
++ func_append func_quote_result "$3$2"
++ set quote "$_G_part" "\\$_G_char"
++ ;;
++ start)
++ set first "" ""
++ func_quote_result=
++ ;;
++ first)
++ set quote "$_G_part" ""
++ ;;
++ esac
++ done
++ IFS=$func_quote_old_IFS
++ done
++ ;;
++ *) ;;
++ esac
++}
++
++
+ # func_quote_for_eval ARG...
+ # --------------------------
+ # Aesthetically quote ARGs to be evaled later.
+@@ -1042,12 +1093,8 @@ func_quote_for_eval ()
+ func_quote_for_eval_unquoted_result=
+ func_quote_for_eval_result=
+ while test 0 -lt $#; do
+- case $1 in
+- *[\\\`\"\$]*)
+- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
+- *)
+- _G_unquoted_arg=$1 ;;
+- esac
++ func_quote "$1"
++ _G_unquoted_arg=$func_quote_result
+ if test -n "$func_quote_for_eval_unquoted_result"; then
+ func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
+ else
+@@ -3346,7 +3346,8 @@ else
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
++ func_quote "$ECHO"
++ qECHO=$func_quote_result
+ $ECHO "\
+
+ # A function that is used when there is no print builtin or printf.
+@@ -8596,8 +8597,8 @@ EOF
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+- relink_command="(cd `pwd`; $relink_command)"
+- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
++ func_quote "(cd `pwd`; $relink_command)"
++ relink_command=$func_quote_result
+ fi
+
+ # Only actually do things if not in dry run mode.
+@@ -8843,7 +8844,8 @@ EOF
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
++ func_quote "$relink_command"
++ relink_command=$func_quote_result
+ if test yes = "$hardcode_automatic"; then
+ relink_command=
+ fi
+--
+2.6.2
diff --git a/patches/specs/2.4.2 b/patches/specs/2.4.2
new file mode 100644
index 0000000..b95a1cd
--- /dev/null
+++ b/patches/specs/2.4.2
@@ -0,0 +1,30 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=702a97fbb09bd7088a50f2b239016d1e32843c24
+
+From 702a97fbb09bd7088a50f2b239016d1e32843c24 Mon Sep 17 00:00:00 2001
+From: Pavel Raiskup <praiskup@redhat.com>
+Date: Fri, 18 Sep 2015 10:36:43 +0200
+Subject: [PATCH] libtool: fix GCC linking with -specs=*
+
+References:
+https://bugzilla.redhat.com/show_bug.cgi?id=985592
+
+* build-aux/ltmain.in (func_mode_link): Pass -specs=*
+to the linker, Fedora uses this option for hardening.
+
+Signed-off-by: Pavel Raiskup <praiskup@redhat.com>
+
+--- ltmain.sh
++++ ltmain.sh
+@@ -7272,10 +7272,12 @@
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
++ # -specs=* GCC specs files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin| \
++ -specs=*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/specs/2.4.6 b/patches/specs/2.4.6
new file mode 100644
index 0000000..4e8e442
--- /dev/null
+++ b/patches/specs/2.4.6
@@ -0,0 +1,31 @@
+https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=702a97fbb09bd7088a50f2b239016d1e32843c24
+
+From 702a97fbb09bd7088a50f2b239016d1e32843c24 Mon Sep 17 00:00:00 2001
+From: Pavel Raiskup <praiskup@redhat.com>
+Date: Fri, 18 Sep 2015 10:36:43 +0200
+Subject: [PATCH] libtool: fix GCC linking with -specs=*
+
+References:
+https://bugzilla.redhat.com/show_bug.cgi?id=985592
+
+* build-aux/ltmain.in (func_mode_link): Pass -specs=*
+to the linker, Fedora uses this option for hardening.
+
+Signed-off-by: Pavel Raiskup <praiskup@redhat.com>
+
+--- ltmain.sh
++++ ltmain.sh
+@@ -7272,10 +7272,12 @@
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
++ # -specs=* GCC specs files
+ # -stdlib=* select c++ std lib with clang
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -specs=*)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
diff --git a/patches/static-flags/2.4.6 b/patches/static-flags/2.4.6
new file mode 100644
index 0000000..892d7aa
--- /dev/null
+++ b/patches/static-flags/2.4.6
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/812026
+https://lists.gnu.org/archive/html/libtool-patches/2019-05/msg00000.html
+
+From: Vincent Lefevre <vincent@vinc17.net>
+Subject: [PATCH] libtool: pass more flags to the linker
+Date: Fri, 3 May 2019 15:19:19 +0200
+To: libtool-patches@gnu.org
+
+Resolves bug 17750.
+
+* build-aux/ltmain.in (func_mode_link): In the flags to be passed through
+unchanged, also pass -static-* and -fcilkplus.
+
+Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
+---
+ build-aux/ltmain.in | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 96b37003..c0e925bb 100644
+--- ltmain.sh
++++ ltmain.sh
+@@ -5380,10 +5380,12 @@ func_mode_link ()
+ # -stdlib=* select c++ std lib with clang
+ # -fsanitize=* Clang/GCC memory and address sanitizer
+ # -fuse-ld=* Linker select flags for GCC
++ # -static-* direct GCC to link specific libraries statically
++ # -fcilkplus Cilk Plus language extension features for C/C++
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*|-fuse-ld=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
+--
+2.20.1
diff --git a/patches/verbose-pic/2.4.7 b/patches/verbose-pic/2.4.7
new file mode 100644
index 0000000..3dfd34f
--- /dev/null
+++ b/patches/verbose-pic/2.4.7
@@ -0,0 +1,39 @@
+From ebe94942061d632ca2a6fa86cdebdf72c7863c07 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 15 Apr 2024 07:15:15 +0100
+Subject: [PATCH] ltmain.in: don't suppress output for PIC compilations
+
+I just hit this in a fascinating place.
+
+When working on xz, I set `-Werror=suggest-attribute=returns_nonnull`, and
+the build failed (as I expected it to), but with no visible error from
+the compiler.
+
+There's a mysterious '>/dev/null 2>&1' on the second line where
+liblzma_la-common.o is built without PIC.
+
+With -fPIC, IPA doesn't end up doing attribute discovery. Without it,
+it does. This behaviour is insane and we should patch it out.
+
+Bug: https://bugs.gentoo.org/135865
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ build-aux/ltmain.in | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 090a4fe8..e383e4cb 100644
+--- a/build-aux/ltmain.in
++++ b/build-aux/ltmain.in
+@@ -1665,8 +1665,6 @@ compiler."
+ func_append command " -o $obj"
+ fi
+
+- # Suppress compiler output if we already did a PIC compilation.
+- func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+--
+2.44.0
+
diff --git a/patches/werror/1.3134-2.2.7a-gnu b/patches/werror/1.3134-2.2.7a-gnu
new file mode 100644
index 0000000..6037873
--- /dev/null
+++ b/patches/werror/1.3134-2.2.7a-gnu
@@ -0,0 +1,57 @@
+Rollup of the flag fixes for the version of libtool in gcc/binutils/gdb.
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -4968,19 +4968,41 @@ func_mode_link ()
+ arg="$func_quote_for_eval_result"
+ ;;
+
+- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+- # -r[0-9][0-9]* specifies the processor on the SGI compiler
+- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+- # +DA*, +DD* enable 64-bit mode on the HP compiler
+- # -q* pass through compiler args for the IBM compiler
+- # -m*, -t[45]*, -txscale* pass through architecture-specific
+- # compiler args for GCC
+- # -F/path gives path to uninstalled frameworks, gcc on darwin
+- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+- # @file GCC response files
+- # -tp=* Portland pgcc target processor selection
++ # Flags to be passed through unchanged, with rationale:
++ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
++ # -r[0-9][0-9]* specify processor for the SGI compiler
++ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
++ # +DA*, +DD* enable 64-bit mode for the HP compiler
++ # -q* compiler args for the IBM compiler
++ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
++ # -F/path path to uninstalled frameworks, gcc on darwin
++ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
++ # -fstack-protector* stack protector flags for GCC
++ # @file GCC response files
++ # -tp=* Portland pgcc target processor selection
++ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
++ # -specs=* GCC specs files
++ # -stdlib=* select c++ std lib with clang
++ # -fdiagnostics-color* simply affects output
++ # -frecord-gcc-switches used to verify flags were respected
++ # -fsanitize=* Clang/GCC memory and address sanitizer
++ # -fno-sanitize* Clang/GCC memory and address sanitizer
++ # -shared-libsan Link with shared sanitizer runtimes (Clang)
++ # -static-libsan Link with static sanitizer runtimes (Clang)
++ # -fuse-ld=* Linker select flags for GCC
++ # -rtlib=* select c runtime lib with clang
++ # --unwindlib=* select unwinder library with clang
++ # -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
++ # -Wa,* Pass flags directly to the assembler
++ # -Werror, -Werror=* Report (specified) warnings as errors
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
++ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*| \
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*| \
++ -stdlib=*|-rtlib=*|--unwindlib=*| \
++ -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
++ -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
++ -fdiagnostics-color*|-frecord-gcc-switches| \
++ -fuse-ld=*|-Wa,*|-Werror|-Werror=*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/werror/2.4.2 b/patches/werror/2.4.2
new file mode 100644
index 0000000..973fea1
--- /dev/null
+++ b/patches/werror/2.4.2
@@ -0,0 +1,28 @@
+https://lists.gnu.org/archive/html/libtool-patches/2022-12/msg00000.html
+
+From d72817b1ee5d7b666bf30b0234e32423252d6ad8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 10 Dec 2022 02:00:22 +0000
+Subject: [PATCH] Allow -Werror and -Werror=* through flag filtering
+
+* build-aux/ltmain.in (func_mode_link): allow -Werror and -Werror=* through
+ flat filtering at link time.
+
+ This is needed for detecting likely-runtime problems with LTO using
+ e.g. -Werror=odr or -Werror=lto-type-mismatch.
+
+Bug: https://bugs.gentoo.org/884767
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -7382,10 +7382,11 @@ func_mode_link ()
+ # -fuse-ld=* Linker select flags for GCC
++ # -Werror, -Werror=* Report (specified) warnings as errors
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin| \
+- -specs=*|-fsanitize=*|-fuse-ld=*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-Werror|-Werror=*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
diff --git a/patches/werror/2.4.6 b/patches/werror/2.4.6
new file mode 100644
index 0000000..15d1776
--- /dev/null
+++ b/patches/werror/2.4.6
@@ -0,0 +1,30 @@
+https://lists.gnu.org/archive/html/libtool-patches/2022-12/msg00000.html
+
+From d72817b1ee5d7b666bf30b0234e32423252d6ad8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 10 Dec 2022 02:00:22 +0000
+Subject: [PATCH] Allow -Werror and -Werror=* through flag filtering
+
+* build-aux/ltmain.in (func_mode_link): allow -Werror and -Werror=* through
+ flat filtering at link time.
+
+ This is needed for detecting likely-runtime problems with LTO using
+ e.g. -Werror=odr or -Werror=lto-type-mismatch.
+
+Bug: https://bugs.gentoo.org/884767
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -7382,10 +7382,11 @@ func_mode_link ()
+ # -fuse-ld=* Linker select flags for GCC
+ # -static-* direct GCC to link specific libraries statically
+ # -fcilkplus Cilk Plus language extension features for C/C++
++ # -Werror, -Werror=* Report (specified) warnings as errors
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Werror|-Werror=*)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
diff --git a/patches/werror/2.4.7 b/patches/werror/2.4.7
new file mode 100644
index 0000000..0cf9399
--- /dev/null
+++ b/patches/werror/2.4.7
@@ -0,0 +1,32 @@
+https://lists.gnu.org/archive/html/libtool-patches/2022-12/msg00000.html
+
+From d72817b1ee5d7b666bf30b0234e32423252d6ad8 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 10 Dec 2022 02:00:22 +0000
+Subject: [PATCH] Allow -Werror and -Werror=* through flag filtering
+
+* build-aux/ltmain.in (func_mode_link): allow -Werror and -Werror=* through
+ flat filtering at link time.
+
+ This is needed for detecting likely-runtime problems with LTO using
+ e.g. -Werror=odr or -Werror=lto-type-mismatch.
+
+Bug: https://bugs.gentoo.org/884767
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -5408,10 +5408,11 @@ func_mode_link ()
+ # -fsanitize=* Clang/GCC memory and address sanitizer
+ # -fuse-ld=* Linker select flags for GCC
+ # -Wa,* Pass flags directly to the assembler
++ # -Werror, -Werror=* Report (specified) warnings as errors
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*|-Werror|-Werror=*)
+ func_quote_arg pretty "$arg"
+ arg=$func_quote_arg_result
+ func_append compile_command " $arg"
+--
+2.38.1
diff --git a/patches/werror/2.4.7-debian b/patches/werror/2.4.7-debian
new file mode 100644
index 0000000..d585724
--- /dev/null
+++ b/patches/werror/2.4.7-debian
@@ -0,0 +1,34 @@
+https://lists.gnu.org/archive/html/libtool-patches/2022-12/msg00000.html
+
+From eb8952bf6df858b144f2dc8b573782e25b527c01 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 10 Dec 2022 02:00:22 +0000
+Subject: [PATCH] Allow -Werror and -Werror=* through flag filtering
+
+* build-aux/ltmain.in (func_mode_link): allow -Werror and -Werror=* through
+ flat filtering at link time.
+
+ This is needed for detecting likely-runtime problems with LTO using
+ e.g. -Werror=odr or -Werror=lto-type-mismatch.
+
+Bug: https://bugs.gentoo.org/884767
+Signed-off-by: Sam James <sam@gentoo.org>
+[rebased on top of Debian ltmain.sh]
+Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -7564,10 +7564,11 @@ func_mode_link ()
+ # -static-* direct GCC to link specific libraries statically
+ # -fcilkplus Cilk Plus language extension features for C/C++
+ # -Wa,* Pass flags directly to the assembler
++ # -Werror, -Werror=* Report (specified) warnings as errors
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+- -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*)
++ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*)
+ func_quote_arg pretty "$arg"
+ arg=$func_quote_arg_result
+ func_append compile_command " $arg"
+--
+2.43.0
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..0cff469
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,8 @@
+/libtools/
+/*.tmp/
+aclocal.m4
+autom4te.cache/
+config.guess
+config.sub
+configure
+ltmain.sh
diff --git a/tests/2.4.6/configure.ac b/tests/2.4.6/configure.ac
new file mode 100644
index 0000000..764d8df
--- /dev/null
+++ b/tests/2.4.6/configure.ac
@@ -0,0 +1,4 @@
+AC_PREREQ([2.69])
+AC_INIT([elt-patches], [ver])
+LT_INIT
+AC_OUTPUT
diff --git a/tests/2.4.7/configure.ac b/tests/2.4.7/configure.ac
new file mode 100644
index 0000000..764d8df
--- /dev/null
+++ b/tests/2.4.7/configure.ac
@@ -0,0 +1,4 @@
+AC_PREREQ([2.69])
+AC_INIT([elt-patches], [ver])
+LT_INIT
+AC_OUTPUT
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..ccfd78f
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,7 @@
+To run the tests, first initialize the environment:
+$ ./setup.sh
+
+Then run the tests:
+$ ./run.sh
+
+Logs will be stored in the tmp dir for checking.
diff --git a/tests/run.sh b/tests/run.sh
new file mode 100755
index 0000000..5424085
--- /dev/null
+++ b/tests/run.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Copyright 1999-2021 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Run eltpatch against copies of libtool for quick testing.
+
+set -e
+cd "$(dirname "$(realpath "$0")")"
+
+export LD=ld
+export CHOST=x86_64-gentoo-linux-gnu
+export ELT_patchdir="${PWD}/../patches"
+eltpatch=${PWD}/../eltpatch
+
+test() {
+ local PV="$1"
+
+ rm -rf "${PV}.tmp"
+ cp -a "${PV}" "${PV}.tmp"
+ export S="${PWD}/${PV}.tmp"
+ export TMPDIR=${S}
+ "${eltpatch}"
+}
+
+mkdir -p libtools
+for f in *.*/configure.ac ; do
+ v=${f%/*}
+ [[ ${v} == *.tmp ]] && continue
+ echo "### ${v}"
+ test "${v}"
+done
diff --git a/tests/setup.sh b/tests/setup.sh
new file mode 100755
index 0000000..6b2022d
--- /dev/null
+++ b/tests/setup.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# Copyright 1999-2021 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Setup local copies of pristine libtool for testing against.
+
+set -e
+cd "$(dirname "$(realpath "$0")")"
+
+: "${DISTDIR:=/var/cache/distfiles}"
+URI_BASE="https://ftpmirror.gnu.org/libtool/"
+
+setup() {
+ local PV="$1"
+ local P="libtool-${PV}"
+ local A="${P}.tar.xz"
+
+ script="libtools/${P}/destdir/bin/libtool"
+ if [[ -e ${script} ]] ; then
+ return
+ fi
+
+ pushd libtools >/dev/null
+ rm -rf "${P}"
+ if [[ -e ${DISTDIR}/${A} ]] ; then
+ printf "unpack "
+ tar xf "${DISTDIR}/${A}"
+ else
+ if [[ ! -e ${A} ]] ; then
+ printf "fetch "
+ wget -nv "${URI_BASE}/${A}"
+ fi
+ printf "unpack "
+ tar xf "${A}"
+ fi
+
+ printf "compile "
+ cd "${P}"
+ ./configure --prefix="${PWD}/destdir" -q >/dev/null
+ make install -j -s >/dev/null
+
+ popd >/dev/null
+}
+
+build() {
+ local PV="$1"
+
+ pushd "${PV}" >/dev/null
+ PATH="${PWD}/../libtools/libtool-${PV}/destdir/bin:${PATH}"
+ autoreconf -i
+ popd >/dev/null
+}
+
+mkdir -p libtools
+for f in *.*/configure.ac ; do
+ v=${f%/*}
+ [[ ${v} == *.tmp ]] && continue
+ printf "${v}: "
+ setup "${v}"
+ build "${v}"
+ echo "done"
+done