blob: bbd9e554c2418018e44b38aaebb4eb68754033e9 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
https://bugs.gentoo.org/484560
From 3eab2b7675fc7e2889cd69285a2a31980a4bf504 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 12 Sep 2013 00:29:40 -0400
Subject: [PATCH] trylink: only prefix libs with -l
If our pkg-config queries pass back a flag like -pthread, the trylink
script will expand that to -l-pthread. So change trylink to only add
the -l prefix to a value that doesn't have a - prefix already.
Reported-by: thaehaid@incognitomail.org
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
scripts/trylink | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/trylink b/scripts/trylink
index a8b0b2e..e471699 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -117,7 +117,7 @@ LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs`
# First link with all libs. If it fails, bail out
echo "Trying libraries: $LDLIBS"
# "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3"
-l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
+l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'`
test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP"
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
@@ -141,7 +141,7 @@ while test "$LDLIBS"; do
for one in $LDLIBS; do
without_one=`echo " $LDLIBS " | sed "s/ $one / /g" | xargs`
# "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3"
- l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
+ l_list=`echo " $without_one " | sed -e 's: \([^- ][^ ]*\): -l\1:g'`
test x"$l_list" != x"" && l_list="$START_GROUP $l_list $END_GROUP"
$debug && echo "Trying -l options: '$l_list'"
try $CC $CFLAGS $LDFLAGS \
@@ -172,7 +172,7 @@ done
# Make the binary with final, minimal list of libs
echo "Final link with: ${LDLIBS:-<none>}"
-l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
+l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'`
test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP"
# --verbose gives us gobs of info to stdout (e.g. linker script used)
if ! test -f busybox_ldscript; then
--
1.8.3.2
|