mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 08:30:34 +08:00
[compiler-rt][Darwin] Fix linker errors for check-asan
A recent change broke `ninja check-asan` on Darwin by causing an error
during linking of ASan unit tests [1].
Move the addition of `-ObjC` compiler flag outside of the new
`if(COMPILER_RT_STANDALONE_BUILD)` block. It doesn't add any global
flags (e.g, `${CMAKE_CXX_FLAGS}`) and the decision to add is based
solely on source paths (`${source_rpath}`).
[1] 8b2fcc42b8, https://reviews.llvm.org/D84466
Differential Revision: https://reviews.llvm.org/D85057
This commit is contained in:
@@ -73,7 +73,6 @@ function(clang_compile object_file source)
|
||||
if(COMPILER_RT_STANDALONE_BUILD)
|
||||
# Only add global flags in standalone build.
|
||||
string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
|
||||
string(REGEX MATCH "[.](m|mm)$" is_objc ${source_rpath})
|
||||
if(is_cxx)
|
||||
string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
@@ -87,9 +86,6 @@ function(clang_compile object_file source)
|
||||
if (APPLE)
|
||||
set(global_flags ${OSX_SYSROOT_FLAG} ${global_flags})
|
||||
endif()
|
||||
if (is_objc)
|
||||
list(APPEND global_flags -ObjC)
|
||||
endif()
|
||||
|
||||
# Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options
|
||||
# which are not supported by Clang.
|
||||
@@ -98,6 +94,12 @@ function(clang_compile object_file source)
|
||||
else()
|
||||
set(compile_flags ${SOURCE_CFLAGS})
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "[.](m|mm)$" is_objc ${source_rpath})
|
||||
if (is_objc)
|
||||
list(APPEND compile_flags "-ObjC")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${object_file}
|
||||
COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c
|
||||
|
||||
Reference in New Issue
Block a user