You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/07/01 17:16:04 UTC

[kudu] 02/02: KUDU-2770: apply ustat removal patch from llvm

This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 70f8131423323004b42e70d85308c0fa07753935
Author: Scott Reynolds <sd...@gmail.com>
AuthorDate: Mon May 27 14:13:48 2019 -0700

    KUDU-2770: apply ustat removal patch from llvm
    
    Summary:
    glib's sys/ustat.h has been deprecated for awhile and it has been
    removed in glibc 2.28: https://lwn.net/Articles/761462/
    
    The LLVM team merged the following into their project:
    https://reviews.llvm.org/rG383fe5c8668f63ef21c646b43f48da9fa41aa100
    and this is a port of that patch.
    
    Change-Id: I506f6031f39972bf9b9dbe3368214da2cf390830
    Reviewed-on: http://gerrit.cloudera.org:8080/13447
    Reviewed-by: Grant Henke <gr...@apache.org>
    Tested-by: Grant Henke <gr...@apache.org>
---
 thirdparty/download-thirdparty.sh           |  5 +--
 thirdparty/patches/llvm-ustat-removal.patch | 56 +++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index 30d4ae2..249fc35 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -317,7 +317,7 @@ fetch_and_patch \
  $PYTHON_SOURCE \
  $PYTHON_PATCHLEVEL
 
-LLVM_PATCHLEVEL=2
+LLVM_PATCHLEVEL=3
 fetch_and_patch \
  llvm-${LLVM_VERSION}-iwyu-${IWYU_VERSION}.src.tar.gz \
  $LLVM_SOURCE \
@@ -327,7 +327,8 @@ fetch_and_patch \
   "patch -p1 < $TP_DIR/patches/llvm-iwyu-nocurses.patch" \
   "patch -p1 < $TP_DIR/patches/llvm-iwyu-include-picker.patch" \
   "patch -d tools/clang/tools/include-what-you-use -p1 < $TP_DIR/patches/llvm-iwyu-llvm-6-compat.patch" \
-  "patch -d projects/compiler-rt -p1 < $TP_DIR/patches/llvm-tsan-disable-trace-switching-after-multithreaded-for.patch"
+  "patch -d projects/compiler-rt -p1 < $TP_DIR/patches/llvm-tsan-disable-trace-switching-after-multithreaded-for.patch" \
+  "patch -d projects -p1 < $TP_DIR/patches/llvm-ustat-removal.patch"
 
 LZ4_PATCHLEVEL=1
 fetch_and_patch \
diff --git a/thirdparty/patches/llvm-ustat-removal.patch b/thirdparty/patches/llvm-ustat-removal.patch
new file mode 100644
index 0000000..ccf621a
--- /dev/null
+++ b/thirdparty/patches/llvm-ustat-removal.patch
@@ -0,0 +1,56 @@
+commit 383fe5c8668f63ef21c646b43f48da9fa41aa100
+Author: Craig Topper <cr...@intel.com>
+Date:   Thu May 24 17:59:47 2018 +0000
+
+    sanitizer: Use pre-computed size of struct ustat for Linux
+    
+    <sys/ustat.h> has been removed from glibc 2.28 by:
+    
+    commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
+    Author: Adhemerval Zanella <ad...@linaro.org>
+    Date: Sun Mar 18 11:28:59 2018 +0800
+    
+    Deprecate ustat syscall interface
+    This patch uses pre-computed size of struct ustat for Linux to fix
+    
+    https://bugs.llvm.org/show_bug.cgi?id=37418
+    
+    Patch by H.J. Lu.
+    
+    Differential Revision: https://reviews.llvm.org/D47281
+    
+    llvm-svn: 333213
+
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 94b8f3f627c..936d8186733 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -159,7 +159,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -253,7 +252,19 @@ namespace __sanitizer {
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID