summaryrefslogtreecommitdiff
path: root/extra/llvm12/add-fno-semantic-interposition.patch
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-11-14 18:45:26 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2021-11-14 18:45:26 +0100
commit990b229364cf9eaf401ee17cbd8d6c4981d522eb (patch)
treee55e83b315256a771f51908cf0ec0c95f87d6fcf /extra/llvm12/add-fno-semantic-interposition.patch
parentc205ac4aa24e1241bf2905aa82ffe600502a59e6 (diff)
downloadpackages-990b229364cf9eaf401ee17cbd8d6c4981d522eb.tar.xz
extra/llvm12: added shim (for rust)
Diffstat (limited to 'extra/llvm12/add-fno-semantic-interposition.patch')
-rw-r--r--extra/llvm12/add-fno-semantic-interposition.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/extra/llvm12/add-fno-semantic-interposition.patch b/extra/llvm12/add-fno-semantic-interposition.patch
new file mode 100644
index 00000000..9edd3671
--- /dev/null
+++ b/extra/llvm12/add-fno-semantic-interposition.patch
@@ -0,0 +1,21 @@
+diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
+--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
++++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
+@@ -305,6 +305,17 @@
+ # On Windows all code is PIC. MinGW warns if -fPIC is used.
+ else()
+ 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: 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))
++ add_flag_if_supported("-fno-semantic-interposition" FNO_SEMANTIC_INTERPOSITION)
++ endif()
+ endif()
+ # GCC for MIPS can miscompile LLVM due to PR37701.
+ if(CMAKE_COMPILER_IS_GNUCXX AND LLVM_NATIVE_ARCH STREQUAL "Mips" AND