[PATCH] D126699: [CMake] Skip linker check if the LLVM_LINKER_SKIP_TEST is set

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 23:29:32 PDT 2022


psamolysov added inline comments.


================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:308
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fuse-ld=${LLVM_USE_LINKER}")
+    check_cxx_source_compiles("int main() { return 0; }" CXX_SUPPORTS_CUSTOM_LINKER)
+    if ( NOT CXX_SUPPORTS_CUSTOM_LINKER )
----------------
phosek wrote:
> I think the underlying issue is that the source we're trying to compile here implicitly includes standard libraries. I think it'd be better to use a simpler one in combination with `-nostdlib` (ideally we would check if `-nostdlib` is supported first) which should avoid the issue altogether and is more correct.
@phosek Thank you very much for the comment. I'm not sure I get your idea correctly, this script tries to compile and link the simplest application: `int main() { return 0; }`. As I get, this use only startup routines (`__start` and its friends) from the standard library. Do you mean the script should link this not as an executable but as a static library or anything else?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126699/new/

https://reviews.llvm.org/D126699



More information about the llvm-commits mailing list