[libcxx-commits] [PATCH] D117537: [cmake] Duplicate `{llvm, compiler_rt}_check_linker_flag` for runtime libs and llvm

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 19 23:56:41 PST 2022


phosek added inline comments.


================
Comment at: compiler-rt/CMakeLists.txt:24-25
+
+  # Find the LLVM sources and simulate LLVM CMake options.
+  include(HandleOutOfTreeLLVM)
+endif()
----------------
Ericson2314 wrote:
> @phosek here is compiler-rt using it, as you wanted.
Thanks, can we land this separately?


================
Comment at: compiler-rt/cmake/config-ix.cmake:168
 # Linker flags.
-compiler_rt_check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
-compiler_rt_check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
+llvm_check_linker_flag(CXX "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
+llvm_check_linker_flag(CXX "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: compiler-rt/cmake/config-ix.cmake:169
+llvm_check_linker_flag(CXX "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
+llvm_check_linker_flag(CXX "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
 
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: compiler-rt/cmake/config-ix.cmake:173
   set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat")
-  compiler_rt_check_linker_flag("${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
+  llvm_check_linker_flag(CXX "${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
 endif()
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: compiler-rt/cmake/config-ix.cmake:184
 endif()
-compiler_rt_check_linker_flag("${VERS_OPTION}" COMPILER_RT_HAS_VERSION_SCRIPT)
+llvm_check_linker_flag(CXX "${VERS_OPTION}" COMPILER_RT_HAS_VERSION_SCRIPT)
 
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: compiler-rt/cmake/config-ix.cmake:187
 if(ANDROID)
-  compiler_rt_check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
+  llvm_check_linker_flag(CXX "-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
   check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: compiler-rt/cmake/config-ix.cmake:433
 
-  compiler_rt_check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
+  llvm_check_linker_flag(CXX "-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
   if(COMPILER_RT_HAS_APP_EXTENSION)
----------------
This is not C++ specific so `C` should be enough.


================
Comment at: libunwind/cmake/config-ix.cmake:37
 
-llvm_check_linker_flag(-nostdlib++ LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG)
+llvm_check_linker_flag(C "-nostdlib++" LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG)
 if (LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG)
----------------
This flag is C++ specific so this should be `CXX`.


================
Comment at: runtimes/CMakeLists.txt:113
 # (or -nodefaultlibs).
-llvm_check_linker_flag(-nostdlib++ LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
+llvm_check_linker_flag(C "-nostdlib++" LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
 if (LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
----------------
This flag is C++ specific so this should be `CXX`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117537



More information about the libcxx-commits mailing list