add-fno-semantic-interposition.patch 1.1 KB

1234567891011121314151617181920212223
  1. diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
  2. --- a/llvm/cmake/modules/HandleLLVMOptions.cmake
  3. +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
  4. @@ -305,6 +305,17 @@
  5. # On Windows all code is PIC. MinGW warns if -fPIC is used.
  6. else()
  7. add_flag_or_print_warning("-fPIC" FPIC)
  8. + # Enable interprocedural optimizations for non-inline functions which would
  9. + # otherwise be disabled due to GCC -fPIC's default.
  10. + #
  11. + # Note: Clang allows IPO for -fPIC so this optimization is less effective.
  12. + # Older Clang may support -fno-semantic-interposition but it used local
  13. + # aliases to optimize global variables, which is incompatible with copy
  14. + # relocations due to -fno-pic.
  15. + if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
  16. + CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13))
  17. + add_flag_if_supported("-fno-semantic-interposition" FNO_SEMANTIC_INTERPOSITION)
  18. + endif()
  19. endif()
  20. # GCC for MIPS can miscompile LLVM due to PR37701.
  21. if(CMAKE_COMPILER_IS_GNUCXX AND LLVM_NATIVE_ARCH STREQUAL "Mips" AND