Skip to content

Commit 9542d0a

Browse files
committed
[libc] Fix libc build on NVPTX using wrong linker flag
Summary: Ugly hacks abound, we can't actually test linker flags correctly generically because not everyone has `nvlink` as a binary on their machine which would then result in every single flag being unsupported. This is the only 'linker flag' check we have, so just hard code it off.
1 parent 4a9fdda commit 9542d0a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ if( LLVM_ENABLE_ASSERTIONS )
144144
endif()
145145
endif()
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_TARGET}" MATCHES "^amdgcn" OR
150+
"${LLVM_RUNTIMES_TARGET}" MATCHES "^nvptx64")
151+
return()
152+
endif()
153+
154+
147155
if(LLVM_ENABLE_EXPENSIVE_CHECKS)
148156
# When LLVM_ENABLE_EXPENSIVE_CHECKS is ON, LLVM will intercept errors
149157
# using assert(). An explicit check is performed here.
@@ -1141,7 +1149,7 @@ if (UNIX AND
11411149
endif()
11421150

11431151
# lld doesn't print colored diagnostics when invoked from Ninja
1144-
if (UNIX AND CMAKE_GENERATOR MATCHES "Ninja")
1152+
if (UNIX AND CMAKE_GENERATOR MATCHES "Ninja" AND NOT "${LLVM_RUNTIMES_TARGET}" MATCHES "^nvptx64")
11451153
include(CheckLinkerFlag)
11461154
check_linker_flag(CXX "-Wl,--color-diagnostics" LINKER_SUPPORTS_COLOR_DIAGNOSTICS)
11471155
append_if(LINKER_SUPPORTS_COLOR_DIAGNOSTICS "-Wl,--color-diagnostics"

0 commit comments

Comments
 (0)