[PATCH] D53301: [Zorg] Use CMAKE_ASM_FLAGS with compiler-rt.

Dan Albert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 15 14:59:26 PDT 2018


danalbert created this revision.
danalbert added a reviewer: eugenis.
danalbert added a project: Zorg.
Herald added subscribers: dberris, srhines.

Right now this script works because add_compiler_rt_object_libraries
unconditionally adds CMAKE_CXX_FLAGS to every target, even though
CMake will do this automatically for C++ files. Doing this breaks
when using -Werror=unused-command-line-argument and when
CMAKE_CXX_FLAGS contains flags that are not valid for building C or
assembly code (like -stdlib).

This change is needed because I'm changing the default -stdlib for
Android, and this build needs to use an explicit stdlib to revert to
the old behavior since it uses an old NDK.

This change needs to land in four parts:

1. This change: use CMAKE_ASM_FLAGS.
2. Remove the explicit CMAKE_CXX_FLAGS from add_compiler_rt_object_libraries.
3. Reland the change to use an explicit -stdlib.
4. Reland the change to make Android default to -stdlib=libc++.


https://reviews.llvm.org/D53301

Files:
  zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh


Index: zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh
===================================================================
--- zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh
+++ zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh
@@ -44,6 +44,7 @@
   local ANDROID_LIBRARY_OUTPUT_DIR=$(ls -d $ROOT/llvm_build64/lib/clang/* | tail -1)
   local ANDROID_EXEC_OUTPUT_DIR=$ROOT/llvm_build64/bin
   local ANDROID_FLAGS="--target=$_triple --sysroot=$ANDROID_TOOLCHAIN/sysroot -B$ANDROID_TOOLCHAIN"
+  local ANDROID_CXX_FLAGS="$ANDROID_FLAGS -stdlib=libstdc++"
 
   # Always clobber android build tree.
   # It has a hidden dependency on clang (through CXX) which is not known to
@@ -57,8 +58,9 @@
     -DLLVM_ENABLE_WERROR=OFF \
     -DCMAKE_C_COMPILER=$ROOT/llvm_build64/bin/clang \
     -DCMAKE_CXX_COMPILER=$ROOT/llvm_build64/bin/clang++ \
+    -DCMAKE_ASM_FLAGS="$ANDROID_FLAGS" \
     -DCMAKE_C_FLAGS="$ANDROID_FLAGS" \
-    -DCMAKE_CXX_FLAGS="$ANDROID_FLAGS" \
+    -DCMAKE_CXX_FLAGS="$ANDROID_CXX_FLAGS" \
     -DCMAKE_EXE_LINKER_FLAGS="-pie" \
     -DCMAKE_SKIP_RPATH=ON \
     -DLLVM_BUILD_RUNTIME=OFF \
@@ -73,8 +75,9 @@
     -DCOMPILER_RT_BUILD_BUILTINS=OFF \
     -DCOMPILER_RT_INCLUDE_TESTS=ON \
     -DCOMPILER_RT_ENABLE_WERROR=ON \
+    -DCMAKE_ASM_FLAGS="$ANDROID_FLAGS" \
     -DCMAKE_C_FLAGS="$ANDROID_FLAGS" \
-    -DCMAKE_CXX_FLAGS="$ANDROID_FLAGS" \
+    -DCMAKE_CXX_FLAGS="$ANDROID_CXX_FLAGS" \
     -DANDROID=1 \
     -DCOMPILER_RT_TEST_COMPILER_CFLAGS="$ANDROID_FLAGS" \
     -DCOMPILER_RT_TEST_TARGET_TRIPLE=$_triple \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53301.169759.patch
Type: text/x-patch
Size: 1582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181015/d4c0d9e0/attachment.bin>


More information about the llvm-commits mailing list