[llvm] 62cc3cd - [CMake] Disable -fno-semantic-interposition for GCC<10.3 on SystemZ
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 22:09:26 PDT 2021
Author: Haruki Imai
Date: 2021-07-08T22:09:21-07:00
New Revision: 62cc3cdda64aaaca5bfeba4b131ab6b5f50b4e0c
URL: https://github.com/llvm/llvm-project/commit/62cc3cdda64aaaca5bfeba4b131ab6b5f50b4e0c
DIFF: https://github.com/llvm/llvm-project/commit/62cc3cdda64aaaca5bfeba4b131ab6b5f50b4e0c.diff
LOG: [CMake] Disable -fno-semantic-interposition for GCC<10.3 on SystemZ
`-fno-semantic-interposition` was added for GCC in D102453, but some MLIR tests
on SystemZ failed with GCC<10.3 due to a bug.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D105453
Added:
Modified:
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 75a8fec29671d..0c3419390c275 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -313,13 +313,15 @@ if( LLVM_ENABLE_PIC )
add_flag_or_print_warning("-fPIC" FPIC)
# Enable interprocedural optimizations for non-inline functions which would
# otherwise be disabled due to GCC -fPIC's default.
+ # 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.
- if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
- CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13))
+ 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))
add_flag_if_supported("-fno-semantic-interposition" FNO_SEMANTIC_INTERPOSITION)
endif()
endif()
More information about the llvm-commits
mailing list