termux-packages/packages/emscripten/llvm-project.git-patch.txt

60 lines
2.5 KiB
Plaintext
Raw Normal View History

diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 16331d948b12..c99b3574e218 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -188,6 +188,10 @@ endif()
add_compile_flags_if_supported(-Werror=return-type)
if (LIBUNWIND_ENABLE_CET)
+ if (NOT "libunwind" IN_LIST LLVM_ENABLE_RUNTIMES
+ AND "clang" IN_LIST LLVM_ENABLE_PROJECTS)
+ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../clang/lib/Headers")
+ endif()
add_compile_flags_if_supported(-fcf-protection=full)
add_compile_flags_if_supported(-mshstk)
if (NOT LIBUNWIND_SUPPORTS_FCF_PROTECTION_EQ_FULL_FLAG)
diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
index e38d32336929..aadb4bc6a083 100644
--- a/libunwind/src/assembly.h
+++ b/libunwind/src/assembly.h
@@ -15,7 +15,7 @@
#ifndef UNWIND_ASSEMBLY_H
#define UNWIND_ASSEMBLY_H
-#if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__)
+#if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__) && defined(_LIBUNWIND_USE_CET)
#include <cet.h>
#define _LIBUNWIND_CET_ENDBR _CET_ENDBR
#else
diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
index 02c11f7689fb..eb6a02ec9198 100644
--- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
+++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
@@ -285,7 +285,7 @@ private:
uintptr_t SlabSize = 0;
uintptr_t CurrentSlabOffset = 0;
SectionIDMap *SecIDMap = nullptr;
-#if defined(__x86_64__) && defined(__ELF__)
+#if defined(__x86_64__) && defined(__ELF__) && !defined(__TERMUX__)
unsigned UsedTLSStorage = 0;
#endif
};
@@ -347,7 +347,7 @@ uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
// In case the execution needs TLS storage, we define a very small TLS memory
// area here that will be used in allocateTLSSection().
-#if defined(__x86_64__) && defined(__ELF__)
+#if defined(__x86_64__) && defined(__ELF__) && !defined(__TERMUX__)
extern "C" {
alignas(16) __attribute__((visibility("hidden"), tls_model("initial-exec"),
used)) thread_local char LLVMRTDyldTLSSpace[16];
@@ -358,7 +358,7 @@ TrivialMemoryManager::TLSSection
TrivialMemoryManager::allocateTLSSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName) {
-#if defined(__x86_64__) && defined(__ELF__)
+#if defined(__x86_64__) && defined(__ELF__) && !defined(__TERMUX__)
if (Size + UsedTLSStorage > sizeof(LLVMRTDyldTLSSpace)) {
return {};
}