File tree Expand file tree Collapse file tree 6 files changed +6
-38
lines changed
compiler-rt/cmake/Modules Expand file tree Collapse file tree 6 files changed +6
-38
lines changed Original file line number Diff line number Diff line change @@ -418,11 +418,9 @@ macro(construct_compiler_rt_default_triple)
418418 # Pass the necessary flags to make flag detection work.
419419 if ("${COMPILER_RT_DEFAULT_TARGET_ARCH} " MATCHES "amdgcn" )
420420 set (COMPILER_RT_GPU_BUILD ON )
421- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nogpulib" )
422421 elseif ("${COMPILER_RT_DEFAULT_TARGET_ARCH} " MATCHES "nvptx" )
423422 set (COMPILER_RT_GPU_BUILD ON )
424- set (CMAKE_REQUIRED_FLAGS
425- "${CMAKE_REQUIRED_FLAGS} -flto -c -Wno-unused-command-line-argument" )
423+ set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -flto -c" )
426424 endif ()
427425 endif ()
428426
Original file line number Diff line number Diff line change @@ -221,15 +221,6 @@ endif()
221221# System Introspection #
222222########################
223223
224- # The GPU targets require a few mandatory arguments to make the standard CMake
225- # check flags happy.
226- if ("${LLVM_RUNTIMES_TARGET} " MATCHES "^amdgcn" )
227- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nogpulib" )
228- elseif ("${LLVM_RUNTIMES_TARGET} " MATCHES "^nvptx" )
229- set (CMAKE_REQUIRED_FLAGS
230- "${CMAKE_REQUIRED_FLAGS} -flto -c -Wno-unused-command-line-argument" )
231- endif ()
232-
233224include (CheckCXXSymbolExists)
234225include (CheckCXXSourceCompiles)
235226check_cxx_symbol_exists(strerror_r string .h HAVE_STRERROR_R)
Original file line number Diff line number Diff line change @@ -20,12 +20,6 @@ endif()
2020if (LIBC_TARGET_TRIPLE)
2121 set (CMAKE_REQUIRED_FLAGS "--target=${LIBC_TARGET_TRIPLE} " )
2222endif ()
23- if (LIBC_TARGET_ARCHITECTURE_IS_AMDGPU)
24- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nogpulib" )
25- elseif (LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
26- set (CMAKE_REQUIRED_FLAGS
27- "${CMAKE_REQUIRED_FLAGS} -flto -c -Wno-unused-command-line-argument" )
28- endif ()
2923
3024# Optionally set up a job pool to limit the number of GPU tests run in parallel.
3125# This is sometimes necessary as running too many tests in parallel can cause
Original file line number Diff line number Diff line change @@ -144,12 +144,6 @@ if( LLVM_ENABLE_ASSERTIONS )
144144 endif ()
145145endif ()
146146
147- # If we are targeting a GPU architecture in a runtimes build we want to ignore
148- # all the standard flag handling.
149- if (LLVM_RUNTIMES_GPU_BUILD)
150- return ()
151- endif ()
152-
153147if (LLVM_ENABLE_EXPENSIVE_CHECKS)
154148 # When LLVM_ENABLE_EXPENSIVE_CHECKS is ON, LLVM will intercept errors
155149 # using assert(). An explicit check is performed here.
Original file line number Diff line number Diff line change @@ -99,14 +99,6 @@ else()
9999 set (CMAKE_CXX_EXTENSIONS NO )
100100endif ()
101101
102- # Targeting the GPU directly requires a few flags to make CMake happy.
103- if ("${CMAKE_CXX_COMPILER_TARGET} " MATCHES "^amdgcn" )
104- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nogpulib" )
105- elseif ("${CMAKE_CXX_COMPILER_TARGET} " MATCHES "^nvptx" )
106- set (CMAKE_REQUIRED_FLAGS
107- "${CMAKE_REQUIRED_FLAGS} -flto -c -Wno-unused-command-line-argument" )
108- endif ()
109-
110102# Check and set up common compiler flags.
111103include (config-ix)
112104include (HandleOpenMPOptions)
Original file line number Diff line number Diff line change @@ -181,15 +181,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
181181 endif ()
182182endif ()
183183
184+ # The NVPTX target needs to override linking to pass compiler flag checks.
185+ if ("${LLVM_RUNTIMES_TARGET} " MATCHES "^nvptx" )
186+ set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -flto -c" )
187+ endif ()
188+
184189# Avoid checking whether the compiler is working.
185190set (LLVM_COMPILER_CHECKED ON )
186191
187- # This can be used to detect whether we're targeting a GPU architecture.
188- if ("${LLVM_RUNTIMES_TARGET} " MATCHES "^amdgcn" OR
189- "${LLVM_RUNTIMES_TARGET} " MATCHES "^nvptx64" )
190- set (LLVM_RUNTIMES_GPU_BUILD ON )
191- endif ()
192-
193192# Handle common options used by all runtimes.
194193include (AddLLVM)
195194include (HandleLLVMOptions)
You can’t perform that action at this time.
0 commit comments