[clang] adf0b8c - Revert "[compiler-rt] Compile assembly files as ASM not C"

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 06:25:45 PDT 2020


Author: Raphael Isemann
Date: 2020-08-20T15:25:22+02:00
New Revision: adf0b8cc70325f027d202139e3ff984c41896b57

URL: https://github.com/llvm/llvm-project/commit/adf0b8cc70325f027d202139e3ff984c41896b57
DIFF: https://github.com/llvm/llvm-project/commit/adf0b8cc70325f027d202139e3ff984c41896b57.diff

LOG: Revert "[compiler-rt] Compile assembly files as ASM not C"

This reverts commit d58fd4e52197d55bf42ca446c8b0ed31b5c2ec1f. This broke
compiler-rt compilation on macOS:

codesign --sign - /Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/clang/12.0.99/lib/darwin/libclang_rt.tsan_ios_dynamic.dylib
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_amd64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_aarch64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
  "_wrap__setjmp", referenced from:
      substitution__setjmp in tsan_interceptors_posix.cpp.o
  "_wrap_setjmp", referenced from:
      substitution_setjmp in tsan_interceptors_posix.cpp.o
  "_wrap_sigsetjmp", referenced from:
      substitution_sigsetjmp in tsan_interceptors_posix.cpp.o
ld: symbol(s) not found for architecture arm64

Added: 
    

Modified: 
    clang/runtime/CMakeLists.txt
    compiler-rt/cmake/Modules/AddCompilerRT.cmake

Removed: 
    


################################################################################
diff  --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt
index 61bbbf8faedd..e20cc26f60af 100644
--- a/clang/runtime/CMakeLists.txt
+++ b/clang/runtime/CMakeLists.txt
@@ -75,7 +75,6 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
     CMAKE_ARGS ${CLANG_COMPILER_RT_CMAKE_ARGS}
                -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
                -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
-               -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
                -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
                -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 7063cf89d7ab..efb660818270 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -109,11 +109,13 @@ endfunction()
 
 function(add_asm_sources output)
   set(${output} ${ARGN} PARENT_SCOPE)
-  # Make sure ASM language is available.
-  # We explicitly mark the source files as ASM, so they don't get passed to the
-  # C/CXX compiler and hopes that it recognizes them as assembly.
-  enable_language(ASM)
-  set_source_files_properties(${ARGN} PROPERTIES LANGUAGE ASM)
+  # Xcode will try to compile asm files as C ('clang -x c'), and that will fail.
+  if (${CMAKE_GENERATOR} STREQUAL "Xcode")
+    enable_language(ASM)
+  else()
+    # Pass ASM file directly to the C++ compiler.
+    set_source_files_properties(${ARGN} PROPERTIES LANGUAGE C)
+  endif()
 endfunction()
 
 macro(set_output_name output name arch)


        


More information about the cfe-commits mailing list