Fix LLVM target initialization to deal with sociopathic outside projects

that like to randomly define things like "X86", regenerate autoconf bits
and update cmake.

Fixes PR7852.

Patch by Xerxes Rånby!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2010-08-30 18:34:48 +00:00
parent 2027362e8d
commit 753f3265da
9 changed files with 75 additions and 46 deletions

View File

@ -64,15 +64,10 @@ static inline void LLVMInitializeAllTargets(void) {
for JIT applications to ensure that the target gets linked in correctly. */
static inline LLVMBool LLVMInitializeNativeTarget(void) {
/* If we have a native target, initialize it to ensure it is linked in. */
#ifdef LLVM_NATIVE_ARCH
#define DoInit2(TARG) \
LLVMInitialize ## TARG ## Info (); \
LLVMInitialize ## TARG ()
#define DoInit(T) DoInit2(T)
DoInit(LLVM_NATIVE_ARCH);
#ifdef LLVM_NATIVE_TARGET
LLVM_NATIVE_TARGETINFO();
LLVM_NATIVE_TARGET();
return 0;
#undef DoInit
#undef DoInit2
#else
return 1;
#endif