[PATCH] D62104: [crt] Use CMAKE_C_COMPILER_ARG1 in compiler invocation

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 18 20:20:56 PDT 2019


phosek created this revision.
phosek added reviewers: thakis, smeenai, beanz.
Herald added subscribers: llvm-commits, Sanitizers, mgorny.
Herald added projects: LLVM, Sanitizers.

This is needed when using compiler wrappers such as ccache or distcc
and should address the failure on clang-x86_64-debian-fast bot.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D62104

Files:
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/lib/crt/CMakeLists.txt


Index: compiler-rt/lib/crt/CMakeLists.txt
===================================================================
--- compiler-rt/lib/crt/CMakeLists.txt
+++ compiler-rt/lib/crt/CMakeLists.txt
@@ -25,8 +25,8 @@
   set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}")
   foreach(substitution ${substitutions})
     if(substitution STREQUAL "<CMAKE_C_COMPILER>")
-      string(REPLACE "<CMAKE_C_COMPILER>"
-             "${CMAKE_C_COMPILER}" test_compile_command ${test_compile_command})
+      string(REPLACE "<CMAKE_C_COMPILER>" "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
+             test_compile_command ${test_compile_command})
     elseif(substitution STREQUAL "<OBJECT>")
       string(REPLACE "<OBJECT>" "${TARGET_NAME}/CheckSectionExists.o"
              test_compile_command ${test_compile_command})
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -262,10 +262,11 @@
       string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
              ${CMAKE_C_COMPILE_OBJECT})
       set(compile_command_${libname} "${CMAKE_C_COMPILE_OBJECT}")
+
       set(output_file_${libname} ${output_name_${libname}}${CMAKE_C_OUTPUT_EXTENSION})
       foreach(substitution ${substitutions})
         if(substitution STREQUAL "<CMAKE_C_COMPILER>")
-          string(REPLACE "<CMAKE_C_COMPILER>" "${CMAKE_C_COMPILER}"
+          string(REPLACE "<CMAKE_C_COMPILER>" "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
                  compile_command_${libname} ${compile_command_${libname}})
         elseif(substitution STREQUAL "<OBJECT>")
           string(REPLACE "<OBJECT>" "${output_dir_${libname}}/${output_file_${libname}}"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62104.200165.patch
Type: text/x-patch
Size: 1792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190519/31f3e0ad/attachment.bin>


More information about the llvm-commits mailing list