[llvm-commits] [llvm] r40600 - in /llvm/trunk: autoconf/configure.ac include/llvm/Config/config.h.in lib/ExecutionEngine/JIT/JIT.cpp

Anton Korobeynikov asl at math.spbu.ru
Mon Jul 30 13:02:03 PDT 2007


Author: asl
Date: Mon Jul 30 15:02:02 2007
New Revision: 40600

URL: http://llvm.org/viewvc/llvm-project?rev=40600&view=rev
Log:
Add detection of __dso_handle presence during configure. Use this information in the
JITer (short path is added for darwin). This is needed to properly JIT llvm-gcc-4.2-built
binaries, since cxa_atexit is enabled by default on much more targets.

Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/include/llvm/Config/config.h.in
    llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=40600&r1=40599&r2=40600&view=diff

==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Mon Jul 30 15:02:02 2007
@@ -766,6 +766,9 @@
 dnl===
 dnl===-----------------------------------------------------------------------===
 
+dnl Check, whether __dso_handle is present
+AC_CHECK_FUNCS([__dso_handle])
+
 dnl See if the llvm-gcc executable can compile to LLVM assembly
 AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
 [llvm_cv_llvmgcc_sanity="no"

Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=40600&r1=40599&r2=40600&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Mon Jul 30 15:02:02 2007
@@ -437,6 +437,9 @@
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
+/* Define to 1 if you have the `__dso_handle' function. */
+#undef HAVE___DSO_HANDLE
+
 /* Installation directory for binary executables */
 #undef LLVM_BINDIR
 

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=40600&r1=40599&r2=40600&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Mon Jul 30 15:02:02 2007
@@ -27,17 +27,29 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetJITInfo.h"
+
+#include "llvm/Config/config.h"
+
 using namespace llvm;
 
 #ifdef __APPLE__ 
-#include <AvailabilityMacros.h>
-#if defined(MAC_OS_X_VERSION_10_4) && \
-    ((MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \
-     (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \
-      __APPLE_CC__ >= 5330))
-// __dso_handle is resolved by Mac OS X dynamic linker.
-extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
+// Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead
+// of atexit). It passes the address of linker generated symbol __dso_handle
+// to the function.
+// This configuration change happened at version 5330.
+# include <AvailabilityMacros.h>
+# if defined(MAC_OS_X_VERSION_10_4) && \
+     ((MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \
+      (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \
+       __APPLE_CC__ >= 5330))
+#  ifndef HAVE___DSO_HANDLE
+#   define HAVE___DSO_HANDLE 1
+#  endif
+# endif
 #endif
+
+#if HAVE___DSO_HANDLE
+extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
 #endif
 
 static struct RegisterJIT {
@@ -302,14 +314,7 @@
 
   // If the global is external, just remember the address.
   if (GV->isDeclaration()) {
-#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_4) && \
-    ((MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \
-     (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \
-      __APPLE_CC__ >= 5330))
-    // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead
-    // of atexit). It passes the address of linker generated symbol __dso_handle
-    // to the function.
-    // This configuration change happened at version 5330.
+#if HAVE___DSO_HANDLE
     if (GV->getName() == "__dso_handle")
       return (void*)&__dso_handle;
 #endif





More information about the llvm-commits mailing list