Pass -fsanitize=* and -fuse-ld=* option down to gcc

Patches are back-ported from upstream.

Resolves: rhbz#2024647
Version: 2.4.6-48

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Frederic Berat 2022-01-27 15:33:05 +01:00
parent 0d2e488b2a
commit 8ea60b3528
3 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,37 @@
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 1cbe875d..2a5aaadd 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5362,10 +5362,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.34.1

View File

@ -0,0 +1,36 @@
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 40eb0297..26015641 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5363,10 +5363,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.34.1

View File

@ -8,7 +8,7 @@
Summary: The GNU Portable Library Tool
Name: libtool
Version: 2.4.6
Release: 47%{?dist}
Release: 48%{?dist}
License: GPLv2+ and LGPLv2+ and GFDL
URL: http://www.gnu.org/software/libtool/
@ -38,6 +38,12 @@ Patch4: libtool-2.4.6-fatal-handler.patch
# Disable LTO for link-order2 test (Related: #1988112)
Patch5: libtool-2.4.6-disable-lto-link-order2.patch
# rhbz#2024647, upstream a5c6466528c060cc4660ad0319c00740db0e42ba
Patch6: libtool-2.4.6-sanitize.patch
# rhbz#2024647, upstream f9970d99293faf908fdc153a653fa5781095fb7a
Patch7: libtool-2.4.6-use-ld.patch
%if ! 0%{?_module_build}
Patch100: libtool-nodocs.patch
%endif
@ -113,6 +119,8 @@ Static libraries and header files for development with ltdl.
%patch3 -p1 -b .ltdl-hardening
%patch4 -p1 -b .fatal-handler
%patch5 -p1 -b .disable-lto-link-order2
%patch6 -p1 -b .sanitize
%patch7 -p1 -b .use-ld
%if ! 0%{?_module_build}
%patch100 -p1 -b .nodocs
%endif
@ -190,6 +198,10 @@ rm -f %{buildroot}%{_libdir}/libltdl.{a,la}
%changelog
* Thu Jan 27 2022 Frederic Berat <fberat@redhat.com> - 2.4.6-48
- Add support for "-fsanitize", rhbz#2024647
- Add support for "-fuse-ld", rhbz#2024647
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.6-47
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild