From f55b8b4ad990fdf08c095deaa3f491130d45fcb2 Mon Sep 17 00:00:00 2001 From: guoqinglan Date: Mon, 6 May 2024 17:41:23 +0800 Subject: [PATCH] Stop libtool from inserting useless runpaths into binaries --- binutils-libtool-no-rpath.patch | 28 ++++++++++++++++++++++++++++ binutils.spec | 8 +++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 binutils-libtool-no-rpath.patch diff --git a/binutils-libtool-no-rpath.patch b/binutils-libtool-no-rpath.patch new file mode 100644 index 0000000..a4f90a1 --- /dev/null +++ b/binutils-libtool-no-rpath.patch @@ -0,0 +1,28 @@ +diff -rup binutils.orig/ltmain.sh binutils-2.37/ltmain.sh +--- binutils.orig/ltmain.sh 2022-01-27 16:23:09.304207432 +0000 ++++ binutils-2.37/ltmain.sh 2022-01-27 16:23:18.380143759 +0000 +@@ -7103,6 +7103,7 @@ EOF + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -7798,6 +7799,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -7849,6 +7851,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +Only in binutils-2.37: ltmain.sh.orig diff --git a/binutils.spec b/binutils.spec index 4f47bef..c3f8800 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 4 +Release: 5 License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -228,6 +228,9 @@ Patch5007: binutils-update-linker-manual.patch # Lifetime: Fixed in 2.42 (maybe) Patch5008: binutils-gold-empty-dwp.patch +# Purpose: Stop libtool from inserting useless runpaths into binaries. +Patch5009:binutils-libtool-no-rpath.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1266,6 +1269,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Mon May 06 2024 guoqinglan - 2.41-5 +- Stop libtool from inserting useless runpaths into binaries + * Wed Mar 13 2024 peng.zou - 2.41-4 - add ppc64le support to fix error about gold -- Gitee