[PATCH] D22370: Respect LLVM_HOST_TRIPLE when manually specified
Luke Drummond via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 18 03:39:11 PDT 2016
ldrumm added a comment.
In https://reviews.llvm.org/D22370#485676, @beanz wrote:
> Supporting specifying the triple manually is a completely separate issue from the bug you encountered. I'd prefer to make target detection for windows work correctly and reliably so that we don't need to support setting `LLVM_HOST_TRIPLE` manually. Other than the bugs in get_host_triple, is there a reason you feel the need to set the host triple manually?
They are separate issues, I agree, but this kills two birds with one stone, as it fixes the lldb-server cross-compilation issue on win32 *and* enables people to specify the triple manually in the event it is required, while AFAICS not introducing any semantic changes unless the triple is manually specified.
> You are right about using `CMAKE_CL_64`, we should instead use `CMAKE_SIZEOF_VOID_P`. So something more like:
>
> diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake
> index 5de710c..f8c7bf1 100644
> --- a/cmake/modules/GetHostTriple.cmake
> +++ b/cmake/modules/GetHostTriple.cmake
> @@ -2,18 +2,18 @@
> # Invokes config.guess
>
> function( get_host_triple var )
> - if( MSVC )
> - if( CMAKE_CL_64 )
> - set( value "x86_64-pc-win32" )
> - else()
> - set( value "i686-pc-win32" )
> - endif()
> - elseif( MINGW AND NOT MSYS )
> + if( MINGW AND NOT MSYS )
> if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
> set( value "x86_64-w64-mingw32" )
> else()
> set( value "i686-pc-mingw32" )
> endif()
> + elseif( CMAKE_HOST_WIN32 )
> + if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
> + set( value "x86_64-pc-win32" )
> + else()
> + set( value "i686-pc-win32" )
> + endif()
> else( MSVC )
> set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
> execute_process(COMMAND sh ${config_guess}
>
I'm afraid this won't work. As Tamas mentioned, we're not trying to detect windows; we're trying to detect the triple of the host the lldb-server is going to run on. The triple will need to be arm32-linux-unknown-android or similar. This does is the exact opposite of what we're trying to achieve, and unconditionally sets a win32 triple regardless of the cross compiler.
Repository:
rL LLVM
https://reviews.llvm.org/D22370
More information about the llvm-commits
mailing list