|
|
a4ac56 |
From f6bc8fb3d26892ba1a84ba2df76beedd51998dd2 Mon Sep 17 00:00:00 2001
|
|
|
a4ac56 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
a4ac56 |
Date: Mon, 29 Jan 2018 16:34:17 +0100
|
|
|
a4ac56 |
Subject: [PATCH] hints/linux: Add -lphtread to lddlflags
|
|
|
a4ac56 |
MIME-Version: 1.0
|
|
|
a4ac56 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a4ac56 |
Content-Transfer-Encoding: 8bit
|
|
|
a4ac56 |
|
|
|
a4ac56 |
Passing -z defs to linker flags causes perl to fail to build if threads are
|
|
|
a4ac56 |
enabled:
|
|
|
a4ac56 |
|
|
|
a4ac56 |
gcc -shared -Wl,-z,relro -Wl,-z,defs -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -fstack-protector-strong Bzip2.o -o ../../lib/auto/Compress/Raw/Bzip2/Bzip2.so \
|
|
|
a4ac56 |
-L/usr/lib64 -lbz2 "-L../.." -lperl \
|
|
|
a4ac56 |
|
|
|
a4ac56 |
Bzip2.o: In function `deRef':
|
|
|
a4ac56 |
/builddir/build/BUILD/perl-5.26.1/cpan/Compress-Raw-Bzip2/Bzip2.xs:256: undefined reference to `pthread_getspecific'
|
|
|
a4ac56 |
|
|
|
a4ac56 |
The reason is Bzip2.xs calls dTHX macro included from thread.h via perl.h that
|
|
|
a4ac56 |
expands to pthread_getspecific() function call that is defined in pthread
|
|
|
a4ac56 |
library. But the pthread library is not explicitly linked to Bzip.so (see the
|
|
|
a4ac56 |
gcc command). This is exactly what -z defs linker flag enforces.
|
|
|
a4ac56 |
|
|
|
a4ac56 |
Underlinking ELFs can be dangerous because in case of versioned
|
|
|
a4ac56 |
symbols it can cause run-time binding to an improper version symbol or
|
|
|
a4ac56 |
even to an symbold from different library.
|
|
|
a4ac56 |
|
|
|
a4ac56 |
This patch fixes hints for Linux by adding -lpthreads to lddlflags. It
|
|
|
a4ac56 |
also adds -shared there because Configure.sh adds it only hints return
|
|
|
a4ac56 |
lddlflags empty.
|
|
|
a4ac56 |
|
|
|
a4ac56 |
<https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3RHZEHLRUHJFF2XGHI5RB6YPDNLDR4HG/>
|
|
|
a4ac56 |
|
|
|
a4ac56 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
a4ac56 |
---
|
|
|
a4ac56 |
hints/linux.sh | 4 ++++
|
|
|
a4ac56 |
1 file changed, 4 insertions(+)
|
|
|
a4ac56 |
|
|
|
a4ac56 |
diff --git a/hints/linux.sh b/hints/linux.sh
|
|
|
a4ac56 |
index 3f38ea07f1..9ec3bc02ef 100644
|
|
|
a4ac56 |
--- a/hints/linux.sh
|
|
|
a4ac56 |
+++ b/hints/linux.sh
|
|
|
a4ac56 |
@@ -353,12 +353,16 @@ if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
|
|
|
a4ac56 |
echo "$libswanted" >&4
|
|
|
a4ac56 |
fi
|
|
|
a4ac56 |
|
|
|
a4ac56 |
+# Flags needed to produce shared libraries.
|
|
|
a4ac56 |
+lddlflags='-shared'
|
|
|
a4ac56 |
+
|
|
|
a4ac56 |
# This script UU/usethreads.cbu will get 'called-back' by Configure
|
|
|
a4ac56 |
# after it has prompted the user for whether to use threads.
|
|
|
a4ac56 |
cat > UU/usethreads.cbu <<'EOCBU'
|
|
|
a4ac56 |
case "$usethreads" in
|
|
|
a4ac56 |
$define|true|[yY]*)
|
|
|
a4ac56 |
ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
|
|
|
a4ac56 |
+ lddlflags="-lpthread $lddlflags"
|
|
|
a4ac56 |
if echo $libswanted | grep -v pthread >/dev/null
|
|
|
a4ac56 |
then
|
|
|
a4ac56 |
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
|
|
|
a4ac56 |
--
|
|
|
a4ac56 |
2.13.6
|
|
|
a4ac56 |
|