[PATCH] D40947: [cmake] Make setting of CMAKE_C(XX)_COMPILER flags overridable for cross-builds

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 11:53:17 PST 2017


hintonda added a comment.

Did this fix an existing problem?  It looks like some of this logic is OBE.

Here's my reasoning.

As far as I can tell, this code is only run when either `-DLLVM_OPTIMIZED_TABLEGEN=ON` or `CMAKE_SYSTEM_NAME` variable is passed or set in the appropriate cache or toolchain file -- which cmake ultimately uses to set `CMAKE_CROSSCOMPILING=ON` internally.

In both cases, these variables are used to set `LLVM_USE_HOST_TOOLS`, which, if true, includes CrossCompile.cmake in llvm/CMakeLists.txt.  CrossCompile.cmake defines two functions, `llvm_create_cross_target` and `llvm_create_cross_target_internal`, and ultimately calls `llvm_create_cross_target_internal(NATIVE "" Release)` -- I can't find any other places where either of these two functions are called.

If this is in fact the only call to `llvm_create_cross_target_internal`, in this case with toolchain = "", the toolchain file will be `${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake` which doesn't match any existing file, and is therefore never passed via `CROSS_TOOLCHAIN_FLAGS_INIT` to the custom cmake command.

Are there any calls to `llvm_create_cross_target` or `llvm_create_cross_target_internal` that I've missed where a valid toolchain is actually passed?  If not, is there a reason to maintain the toolchain logic in `llvm_create_cross_target`?


Repository:
  rL LLVM

https://reviews.llvm.org/D40947





More information about the llvm-commits mailing list