[PATCH] D117183: [CMake] Don't use -fno-semantic-interposition with Clang<=13
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 12 22:43:54 PST 2022
MaskRay created this revision.
MaskRay added a reviewer: ljmf00.
Herald added subscribers: pengfei, mgorny.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Clang 13 has a -fsanitize-coverage bug that incorrectly adding comdat to
dso_local functions in -fPIC mode. This can lead to `relocation R_X86_64_PC32
cannot be used against symbol` in -DLLVM_USE_SANITIZE_COVERAGE=ON build when a
shared object is built (e.g. -DLLVM_BUILD_LLVM_DYLIB=on).
For simplicity, just disallow Clang 13 entirely.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117183
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -315,12 +315,11 @@
# Note: GCC<10.3 has a bug on SystemZ.
#
# Note: Clang allows IPO for -fPIC so this optimization is less effective.
- # Older Clang may support -fno-semantic-interposition but it used local
- # aliases to optimize global variables, which is incompatible with copy
- # relocations due to -fno-pic.
+ # Clang 13 has a bug that -fsanitize-coverage may incorrectly add comdat to
+ # dso_local functions.
if ((CMAKE_COMPILER_IS_GNUCXX AND
NOT (LLVM_NATIVE_ARCH STREQUAL "SystemZ" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.3))
- OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13))
+ OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 14))
add_flag_if_supported("-fno-semantic-interposition" FNO_SEMANTIC_INTERPOSITION)
endif()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117183.399547.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/853be582/attachment.bin>
More information about the llvm-commits
mailing list