diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-30 20:02:02 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-30 20:02:02 +0000 |
commit | 3b30a6e92d1da79674451879d4112a8f83cc12a4 (patch) | |
tree | a36fd9f3b291fac784210de9e61e6d6c43c7d9d4 /lib/ExecutionEngine/JIT | |
parent | ed3fa8552a9b4c92b0374bf9fdb82ffeb3d6dc82 (diff) | |
download | external_llvm-3b30a6e92d1da79674451879d4112a8f83cc12a4.zip external_llvm-3b30a6e92d1da79674451879d4112a8f83cc12a4.tar.gz external_llvm-3b30a6e92d1da79674451879d4112a8f83cc12a4.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 603f8ec..926142f 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -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 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) { // 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 |