diff options
authorPeter Wu <>2019-01-17 11:24:49 +0100
committerPeter Wu <>2019-01-17 11:24:49 +0100
commit649671b195f2f7b0a11d1c53158a34a758fbed33 (patch)
parentbd68ff98c2cad49ebb4495ce977a9d907853d1aa (diff)
downloadwireshark-notes-649671b195f2f7b0a11d1c53158a34a758fbed33.tar.gz use lld only for Clang 8 and newer
GCC does not support -fuse-ld=lld and LLD 7.0.1 has a bug that causes crashes when (statically) linking code that uses thread-local storage without a PLT.
1 files changed, 12 insertions, 5 deletions
diff --git a/ b/
index 01da66d..73c8dcf 100755
--- a/
+++ b/
@@ -50,11 +50,17 @@ CXX=${CXX:-c++}
# "<optimized out>".
# -O1 -g -gdwarf-4 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer
-_default_flags+=\ -fuse-ld=lld
+if $CC --version | grep -qE 'clang version ([89]|[1-9][0-9])'; then
+ # Require Clang and at least LLD 8.0 to avoid broken binaries and crashes.
+ #
+ _default_flags+=\ -fuse-ld=lld
+ _default_flags+=\ -fuse-ld=gold
# -fdebug-prefix-map is supported in GCC since 2007 (?), but only in Clang 3.8
# In GDB, use "dir /tmp/wireshark" to add the source directory anyway.
-# -fmacro-prefix-map (and -ffile-prefix-map) is added in GCC 8,
-# hopefully in Clang 8 as well via
+# -fmacro-prefix-map and -ffile-prefix-map were added in GCC 8. Hopefully it
+# becomes available in Clang 8, see
_default_flags+=" -fdebug-prefix-map=$builddir="
_default_flags+=" -fdebug-prefix-map=$remotesrcdir="
CFLAGS="${CFLAGS-$_default_flags -fno-common}${EXTRA_CFLAGS:+ $EXTRA_CFLAGS}"
@@ -73,6 +79,8 @@ fi
# As extcap/androiddump is located in a subdir, add a special case for that.
# This is NOT suitable (safe) for release! If you ever move the "run" directory,
# be sure not to have an untrusted "extcap" directory next to it.
+# This should no longer be necessary once CMAKE_BUILD_RPATH_USE_ORIGIN is set.
+# See
# Set envvar force_cmake=1 to call cmake before every build
@@ -101,8 +109,7 @@ done
# PATH is needed for /usr/bin/core_perl/pod2man (PCAP)
# ENABLE_QT5=1: install qt5-tools qt5-multimedia on Arch Linux
# BUILD_sshdump=1: install libssh on Arch Linux
-# 32-bit libs on Arch: lib32-libcap lib32-gnutls lib32-gtk3 lib32-krb5
-# lib32-portaudio lib32-geoip lib32-libnl lib32-lua
+# 32-bit libs on Arch: lib32-libcap lib32-gnutls lib32-krb5 lib32-libnl
remotecmd="mysh() {
if [ -e /etc/arch-release ]; then
# In Arch root, so do a build