You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by cs...@apache.org on 2019/06/27 11:52:51 UTC

[impala] 07/07: IMPALA-5031: link fesupport so FE tests run with UBSAN

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

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

commit 03bf2d25663dfa09133c466709a485e03c544236
Author: Jim Apple <jb...@apache.org>
AuthorDate: Sun Jun 16 18:50:31 2019 -0700

    IMPALA-5031: link fesupport so FE tests run with UBSAN
    
    This commit enables the frontend and JDBC tests to run under
    UBSAN. Before this comit, they fail with an error message about
    finding the UBSAN support functions like
    __ubsan_handle_load_invalid_value. Linking those functions into
    libfesupport.so requires using the linker flag --whole-archive so that
    these symbols, which are not directly referenced by the source code
    used to build libfesupport.so, are included.
    
    This patch also enables the custom cluster tests to run under UBSAN;
    they recently gained frontend tests in commit
    d72f3330c1edc9086ba120e6d3469a75c0aea083.
    
    Change-Id: I42049fb3e2de83aee0d0e00e2703788afde739e2
    Reviewed-on: http://gerrit.cloudera.org:8080/13710
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/service/CMakeLists.txt | 8 ++++++++
 bin/impala-config.sh          | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/be/src/service/CMakeLists.txt b/be/src/service/CMakeLists.txt
index 515ee3b..95fcefc 100644
--- a/be/src/service/CMakeLists.txt
+++ b/be/src/service/CMakeLists.txt
@@ -52,6 +52,14 @@ add_library(fesupport SHARED
 )
 add_dependencies(fesupport gen-deps)
 
+if ("${CMAKE_BUILD_TYPE}" STREQUAL "UBSAN"
+    OR "${CMAKE_BUILD_TYPE}" STREQUAL "UBSAN_FULL")
+  target_link_libraries(fesupport "-Wl,--whole-archive \
+    $ENV{IMPALA_TOOLCHAIN}/llvm-$ENV{IMPALA_LLVM_DEBUG_VERSION}/lib/clang/$ENV{IMPALA_LLVM_UBSAN_BASE_VERSION}/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a \
+    $ENV{IMPALA_TOOLCHAIN}/llvm-$ENV{IMPALA_LLVM_DEBUG_VERSION}/lib/clang/$ENV{IMPALA_LLVM_UBSAN_BASE_VERSION}/lib/linux/libclang_rt.ubsan_standalone-x86_64.a \
+    -Wl,--no-whole-archive")
+endif()
+
 target_link_libraries(fesupport ${IMPALA_LINK_LIBS_DYNAMIC_TARGETS})
 
 add_executable(impalad
diff --git a/bin/impala-config.sh b/bin/impala-config.sh
index 7ece4ea..06613df 100755
--- a/bin/impala-config.sh
+++ b/bin/impala-config.sh
@@ -112,6 +112,11 @@ unset IMPALA_LLVM_URL
 export IMPALA_LLVM_ASAN_VERSION=5.0.1-p1
 unset IMPALA_LLVM_ASAN_URL
 
+# LLVM stores some files in subdirectories that are named after what
+# version it thinks it is. We might think it is 5.0.1-p1, based on a
+# patch we have applied, but LLVM thinks its version is 5.0.1.
+export IMPALA_LLVM_UBSAN_BASE_VERSION=5.0.1
+
 # Debug builds should use the release+asserts build to get additional coverage.
 # Don't use the LLVM debug build because the binaries are too large to distribute.
 export IMPALA_LLVM_DEBUG_VERSION=5.0.1-asserts-p1