Skip to content

Commit

Permalink
Added patch for missing sys/ustat.h header file
Browse files Browse the repository at this point in the history
in llvm-5.0.1 build. Fix for cloudera#59
  • Loading branch information
gshimansky committed Dec 18, 2019
1 parent 503859f commit 4d1efae
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ fi
LLVM_VERSION=5.0.1 $SOURCE_DIR/source/llvm/build.sh
LLVM_VERSION=5.0.1-asserts $SOURCE_DIR/source/llvm/build.sh
fi
LLVM_VERSION=5.0.1-p1 $SOURCE_DIR/source/llvm/build.sh
LLVM_VERSION=5.0.1-asserts-p1 $SOURCE_DIR/source/llvm/build.sh
LLVM_VERSION=5.0.1-p2 $SOURCE_DIR/source/llvm/build.sh
LLVM_VERSION=5.0.1-asserts-p2 $SOURCE_DIR/source/llvm/build.sh
)

################################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- llvm-5.0.1.src-p1.orig/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2019-12-18 09:07:53.847300486 -0600
+++ llvm-5.0.1.src-p1/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2019-12-18 09:12:02.778397695 -0600
@@ -159,7 +159,6 @@ typedef struct user_fpregs elf_fpregset_
# 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>
@@ -252,7 +251,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

0 comments on commit 4d1efae

Please sign in to comment.