[PATCH] D87114: [CMake][ExecutionEngine] Upgrade HAVE_EHTABLES to a real config.h macro
David Tenty via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 13:04:11 PDT 2020
daltenty updated this revision to Diff 297318.
daltenty added a comment.
- Add a newline
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87114/new/
https://reviews.llvm.org/D87114
Files:
llvm/cmake/config-ix.cmake
llvm/cmake/unwind.h
llvm/include/llvm/Config/config.h.cmake
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
Index: llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
@@ -31,15 +31,6 @@
RTDyldMemoryManager::~RTDyldMemoryManager() {}
-// Determine whether we can register EH tables.
-#if (defined(__GNUC__) && !defined(__ARM_EABI__) && !defined(__ia64__) && \
- !(defined(_AIX) && defined(__ibmxl__)) && !defined(__MVS__) && \
- !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__))
-#define HAVE_EHTABLE_SUPPORT 1
-#else
-#define HAVE_EHTABLE_SUPPORT 0
-#endif
-
#if HAVE_EHTABLE_SUPPORT
extern "C" void __register_frame(void *);
extern "C" void __deregister_frame(void *);
Index: llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -10,6 +10,7 @@
#include "EHFrameSupportImpl.h"
#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/Config/config.h"
#include "llvm/Support/DynamicLibrary.h"
#define DEBUG_TYPE "jitlink"
@@ -629,15 +630,6 @@
return PC.G.addAnonymousSymbol(*B, Addr - B->getAddress(), 0, false, false);
}
-// Determine whether we can register EH tables.
-#if (defined(__GNUC__) && !defined(__ARM_EABI__) && !defined(__ia64__) && \
- !(defined(_AIX) && defined(__ibmxl__)) && !defined(__MVS__) && \
- !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__))
-#define HAVE_EHTABLE_SUPPORT 1
-#else
-#define HAVE_EHTABLE_SUPPORT 0
-#endif
-
#if HAVE_EHTABLE_SUPPORT
extern "C" void __register_frame(const void *);
extern "C" void __deregister_frame(const void *);
Index: llvm/include/llvm/Config/config.h.cmake
===================================================================
--- llvm/include/llvm/Config/config.h.cmake
+++ llvm/include/llvm/Config/config.h.cmake
@@ -58,6 +58,9 @@
/* Define if dladdr() is available on this platform. */
#cmakedefine HAVE_DLADDR ${HAVE_DLADDR}
+/* Define to 1 if we can register EH tables on this platform. */
+#cmakedefine01 HAVE_EHTABLE_SUPPORT
+
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H}
Index: llvm/cmake/unwind.h
===================================================================
--- /dev/null
+++ llvm/cmake/unwind.h
@@ -0,0 +1,6 @@
+// __register_frame() is used with dynamically generated code to register the
+// FDE for a generated (JIT) code. This header provides protypes, since the gcc
+// version of unwind.h may not, so CMake can check if the corresponding symbols
+// exist in the runtime.
+extern void __register_frame(const void *fde);
+extern void __deregister_frame(const void *fde);
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -205,6 +205,14 @@
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unguarded-availability-new")
endif()
+# Determine whether we can register EH tables.
+check_symbol_exists(__register_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_REGISTER_FRAME)
+check_symbol_exists(__deregister_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_DEREGISTER_FRAME)
+
+if(HAVE_REGISTER_FRAME AND HAVE_DEREGISTER_FRAME)
+ set(HAVE_EHTABLE_SUPPORT TRUE CACHE INTERNAL "")
+endif()
+
check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE)
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
check_symbol_exists(sysconf unistd.h HAVE_SYSCONF)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87114.297318.patch
Type: text/x-patch
Size: 3711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201009/db4ab414/attachment.bin>
More information about the llvm-commits
mailing list