[PATCH] D130541: [cmake] Dedup linker flag check polyfill

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 08:15:40 PDT 2022


compnerd added a comment.

I wonder if we can de-duplicate the checks and re-use the results across the projects.



================
Comment at: compiler-rt/cmake/config-ix.cmake:178
 # Linker flags.
-llvm_check_compiler_linker_flag(C "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
-llvm_check_compiler_linker_flag(C "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
+llvm_check_linker_flag(C "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
+llvm_check_linker_flag(C "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
----------------
I really wold rather prefer `-ztext` as the spelling rather than `-Wl,-z,text`.  `-z` flags are passed through the driver to the linker.  This would mean that we match the behaviour with things like `-fuse-ld=lld` below.


================
Comment at: compiler-rt/cmake/config-ix.cmake:197
 if(ANDROID)
-  llvm_check_compiler_linker_flag(C "-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
+  llvm_check_linker_flag(C "-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
   check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
----------------
Similar, `-zglobal` would be preferable IMO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130541



More information about the llvm-commits mailing list