aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch
blob: 715c254999288d29c131cb5f390497cccef91d1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 7f2b8a1ab4fa1475eeeddfb84eb5b92594bfce43 Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
Date: Tue, 20 Jul 2021 16:54:12 -0300
Subject: openwrt: strip unsave directories from relink command

strip unsave directories from relink command, nuke every -L that looks
like /usr/lib or /lib

This was originally commited to openwrt by Jo-Philipp Wich
<jow@openwrt.org>.

(adjusted to v2.4.6)
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>

--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -2382,6 +2382,9 @@ func_mode_install ()
 	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 	  fi
 
+	  relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"`
+	  relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"`
+
 	  func_warning "relinking '$file'"
 	  func_show_eval "$relink_command" \
 	    'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'