[PATCH] D69196: Fix lld detection in standalone compiler-rt.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 14:41:28 PDT 2019


eugenis created this revision.
eugenis added reviewers: pcc, dyung.
Herald added subscribers: Sanitizers, mgorny, dberris.
Herald added projects: Sanitizers, LLVM.
eugenis marked an inline comment as done.
eugenis added a comment.

As it turns out, hwasan has not been tested on Android for the past two months.
It was broken by this change (which went in without code review, btw, not cool):

  http://llvm.org/viewvc/llvm-project?rev=368242&view=rev

The change may look trivial, but nothing in CMake ever is.

Now, this can not go in right now, because, naturally, most of the stuff we have committed over the past two months does not pass on Android.
It looks like it is almost all Peter.
One thing that I've noticed is that __hwasan_personality_wrapper has neither extern"C" or public visibility, so it is not exported from the shared runtime library.



================
Comment at: compiler-rt/CMakeLists.txt:500
   else()
-    set(COMPILER_RT_HAS_LLD FALSE)
+    set(COMPILER_RT_HAS_LLD COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
   endif()
----------------
I believe all the stuff above this line is necessary for non-standalone case, when the linker flag check would run before the linker itself is built.


Right now all hwasan tests on Android are silently disabled because they
require "has_lld" and standalone compiler-rt can not (and AFAIK was
never able to) set it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69196

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/config-ix.cmake


Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -146,6 +146,7 @@
 
 # Linker flags.
 check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
+check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
 
 if(ANDROID)
   check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -497,7 +497,7 @@
   if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
     set(COMPILER_RT_HAS_LLD TRUE)
   else()
-    set(COMPILER_RT_HAS_LLD FALSE)
+    set(COMPILER_RT_HAS_LLD COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
   endif()
 endif()
 pythonize_bool(COMPILER_RT_HAS_LLD)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69196.225694.patch
Type: text/x-patch
Size: 875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191018/050a20d8/attachment.bin>


More information about the llvm-commits mailing list