diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-01-17 11:24:49 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-01-17 11:24:49 +0100 |
commit | 649671b195f2f7b0a11d1c53158a34a758fbed33 (patch) | |
tree | 625167ed08591abf221c1f5b1bd3f1d0cfef2319 | |
parent | bd68ff98c2cad49ebb4495ce977a9d907853d1aa (diff) | |
download | wireshark-notes-649671b195f2f7b0a11d1c53158a34a758fbed33.tar.gz |
sync-build.sh: 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.
-rwxr-xr-x | sync-build.sh | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sync-build.sh b/sync-build.sh index 01da66d..73c8dcf 100755 --- a/sync-build.sh +++ b/sync-build.sh @@ -50,11 +50,17 @@ CXX=${CXX:-c++} # "<optimized out>". # -O1 -g -gdwarf-4 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer _default_flags=-fdiagnostics-color -_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. + # https://bugs.llvm.org/show_bug.cgi?id=37303 + _default_flags+=\ -fuse-ld=lld +else + _default_flags+=\ -fuse-ld=gold +fi # -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 https://reviews.llvm.org/D49466 +# -fmacro-prefix-map and -ffile-prefix-map were added in GCC 8. Hopefully it +# becomes available in Clang 8, see https://bugs.llvm.org/show_bug.cgi?id=38135 _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 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=15163#c4 RPATH='$ORIGIN:$ORIGIN/../extcap/..' # 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 |