This is an automated email from the ASF dual-hosted git repository. laiyingchun pushed a commit to branch branch-1.17.x in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 088e836cc313fd0ff13d8122f0a75a83d2d884ea Author: Zoltan Martonka <[email protected]> AuthorDate: Mon Aug 14 16:10:13 2023 +0200 [thirdparty] fix TSAN build on Ubuntu 22.04 There are 2 things missing from llvm 11: 1. SIGSTKSZ is no longer a constant in the newer glibc, so caching it in a static variable can result in a crash. This causes the libunwind build to fail at configure: "configure: error: cannot run C compiled programs." The problem is that the conftest.c compile crashes. Although the problem occurs at libunwind build first, it is an llvm issue. More info: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100114 + "/usr/bin/krb5-config --libs gssapi" brings the config "-flto=auto", which is ignored by newer clangs (starting from 14.0), but clang 11 still gives an error. The problem occurs while building curl: "configure: error: one or more libs available at link-time are not available run-time" But the error message is misleading: clang just dies with unknown option. See: https://reviews.llvm.org/D99501 Change-Id: Ib9493a9f7212c26a9cfc1e6a6015340cc5fbfdc5 Reviewed-on: http://gerrit.cloudera.org:8080/20336 Reviewed-by: Alexey Serbin <[email protected]> Tested-by: Alexey Serbin <[email protected]> (cherry picked from commit 75c38d227c687f69935a638946c6408dff876c79) Reviewed-on: http://gerrit.cloudera.org:8080/20407 Tested-by: Kudu Jenkins Reviewed-by: Yingchun Lai <[email protected]> --- thirdparty/download-thirdparty.sh | 6 ++-- ...izer-built-against-glibc-2_34-doesnt-work.patch | 39 ++++++++++++++++++++++ thirdparty/patches/llvm-ignore-flto-values.diff | 11 ++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index df591ef9d..d957274e4 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -331,14 +331,16 @@ fetch_and_patch \ $PYTHON_SOURCE \ $PYTHON_PATCHLEVEL -LLVM_PATCHLEVEL=3 +LLVM_PATCHLEVEL=5 fetch_and_patch \ llvm-${LLVM_VERSION}-iwyu-${IWYU_VERSION}.src.tar.gz \ $LLVM_SOURCE \ $LLVM_PATCHLEVEL \ "patch -p1 < $TP_DIR/patches/llvm-add-iwyu.patch" \ "patch -d projects -p1 < $TP_DIR/patches/llvm-remove-cyclades-inclusion-in-sanitizer.patch" \ - "patch -p2 < $TP_DIR/patches/llvm-fix-missing-include.patch" + "patch -p2 < $TP_DIR/patches/llvm-fix-missing-include.patch" \ + "patch -d projects -p1 < $TP_DIR/patches/llvm-Sanitizer-built-against-glibc-2_34-doesnt-work.patch" \ + "patch -d tools -p1 < $TP_DIR/patches/llvm-ignore-flto-values.diff" LZ4_PATCHLEVEL=0 fetch_and_patch \ diff --git a/thirdparty/patches/llvm-Sanitizer-built-against-glibc-2_34-doesnt-work.patch b/thirdparty/patches/llvm-Sanitizer-built-against-glibc-2_34-doesnt-work.patch new file mode 100644 index 000000000..c54ab006a --- /dev/null +++ b/thirdparty/patches/llvm-Sanitizer-built-against-glibc-2_34-doesnt-work.patch @@ -0,0 +1,39 @@ +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +index f920172c0..33d85ed75 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +@@ -169,7 +169,11 @@ bool SupportsColoredOutput(fd_t fd) { + + #if !SANITIZER_GO + // TODO(glider): different tools may require different altstack size. +-static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. ++static uptr GetAltStackSize() { ++ // SIGSTKSZ is not enough. ++ const uptr kAltStackSize = SIGSTKSZ * 4; ++ return kAltStackSize; ++} + + void SetAlternateSignalStack() { + stack_t altstack, oldstack; +@@ -180,10 +184,9 @@ void SetAlternateSignalStack() { + // TODO(glider): the mapped stack should have the MAP_STACK flag in the + // future. It is not required by man 2 sigaltstack now (they're using + // malloc()). +- void* base = MmapOrDie(kAltStackSize, __func__); +- altstack.ss_sp = (char*) base; ++ altstack.ss_size = GetAltStackSize(); ++ altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__); + altstack.ss_flags = 0; +- altstack.ss_size = kAltStackSize; + CHECK_EQ(0, sigaltstack(&altstack, nullptr)); + } + +@@ -191,7 +194,7 @@ void UnsetAlternateSignalStack() { + stack_t altstack, oldstack; + altstack.ss_sp = nullptr; + altstack.ss_flags = SS_DISABLE; +- altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. ++ altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. + CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); + UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); + } diff --git a/thirdparty/patches/llvm-ignore-flto-values.diff b/thirdparty/patches/llvm-ignore-flto-values.diff new file mode 100644 index 000000000..d273b3b19 --- /dev/null +++ b/thirdparty/patches/llvm-ignore-flto-values.diff @@ -0,0 +1,11 @@ +--- a/clang/include/clang/Driver/Options.td 2020-10-07 10:10:48.000000000 +0000 ++++ b/clang/include/clang/Driver/Options.td 2023-07-27 12:10:37.987953132 +0000 +@@ -1335,6 +1335,8 @@ + def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>; + def fapple_link_rtlib : Flag<["-"], "fapple-link-rtlib">, Group<f_Group>, + HelpText<"Force linking the clang builtins runtime library">; ++def : Flag<["-"], "flto=auto">, Group<clang_ignored_gcc_optimization_f_Group>; ++def : Flag<["-"], "flto=jobserver">, Group<clang_ignored_gcc_optimization_f_Group>; + def flto_EQ : Joined<["-"], "flto=">, Flags<[CoreOption, CC1Option]>, Group<f_Group>, + HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">; + def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group<f_Group>,
