Skip to content

Commit 6b67e22

Browse files
committed
Fix breakage in D89615 (due to cmake version 3.16.5)
Differential Revision: https://reviews.llvm.org/D90764
1 parent ed424b4 commit 6b67e22

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,20 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
119119
CHECK_SYMBOL_EXISTS (__thumb__ "" COMPILER_RT_ARM_THUMB)
120120
endif()
121121
endif()
122+
123+
set(ANDROID_HAS_ELF_TLS 0)
122124
if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*")
123125
set(ANDROID 1)
126+
CHECK_CXX_SOURCE_COMPILES("
127+
int main() {
128+
#if __ANDROID_API__ >= 28
129+
return 0;
130+
#else
131+
#error NO_ELF_TLS
132+
return 1;
133+
#endif
134+
}
135+
" ANDROID_HAS_ELF_TLS)
124136
string(REGEX MATCH "-target(=| +)[^ ]+android([0-9]+)" ANDROID_API_LEVEL "${CMAKE_C_FLAGS}")
125137
set(ANDROID_API_LEVEL ${CMAKE_MATCH_2})
126138
endif()
@@ -277,7 +289,7 @@ if(NOT COMPILER_RT_HAS_FUNC_SYMBOL)
277289
endif()
278290

279291
# Provide some common commmandline flags for Sanitizer runtimes.
280-
if(${ANDROID_API_LEVEL} GREATER_EQUAL 28)
292+
if(ANDROID_HAS_ELF_TLS)
281293
list(APPEND SANITIZER_COMMON_CFLAGS -fno-emulated-tls)
282294
list(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS -fno-emulated-tls)
283295
endif()

0 commit comments

Comments
 (0)