Adds extern "C" ints to the .cpp files that use RegisterTarget, as

well as 2 files that use "Registrator"s. These are to be used by the
MSVC builds, as the Win32 linker does not include libs that are
otherwise unreferenced, even if global constructors in the lib have
side-effects.

Patch by Scott Graham!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Oscar Fuentes 2008-11-15 21:36:30 +00:00
parent 232ed2d373
commit 92adc19be9
13 changed files with 91 additions and 0 deletions

View File

@ -28,6 +28,13 @@ static cl::opt<bool> DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden,
static cl::opt<bool> DisableIfConversion("disable-arm-if-conversion",cl::Hidden,
cl::desc("Disable if-conversion pass"));
/// ARMTargetMachineModule - Note that this is used on hosts that cannot link
/// in a library unless there are references into the library. In particular,
/// it seems that it is not possible to get things to work on Win32 without
/// this. Though it is unused, do not remove it.
extern "C" int ARMTargetMachineModule;
int ARMTargetMachineModule = 0;
// Register the target.
static RegisterTarget<ARMTargetMachine> X("arm", "ARM");
static RegisterTarget<ThumbTargetMachine> Y("thumb", "Thumb");

View File

@ -21,6 +21,13 @@
using namespace llvm;
/// AlphaTargetMachineModule - Note that this is used on hosts that cannot link
/// in a library unless there are references into the library. In particular,
/// it seems that it is not possible to get things to work on Win32 without
/// this. Though it is unused, do not remove it.
extern "C" int AlphaTargetMachineModule;
int AlphaTargetMachineModule = 0;
// Register the targets
static RegisterTarget<AlphaTargetMachine> X("alpha", "Alpha [experimental]");

View File

@ -48,6 +48,14 @@
#include <sstream>
using namespace llvm;
/// CBackendTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int CBackendTargetMachineModule;
int CBackendTargetMachineModule = 0;
// Register the target.
static RegisterTarget<CTargetMachine> X("c", "C backend");

View File

@ -21,6 +21,14 @@
using namespace llvm;
/// CellSPUTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int CellSPUTargetMachineModule;
int CellSPUTargetMachineModule = 0;
namespace {
// Register the targets
RegisterTarget<SPUTargetMachine>

View File

@ -71,6 +71,14 @@ static cl::opt<std::string> NameToGenerate("cppfor", cl::Optional,
cl::desc("Specify the name of the thing to generate"),
cl::init("!bad!"));
/// CppBackendTargetMachineModule - Note that this is used on hosts
/// that cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int CppBackendTargetMachineModule;
int CppBackendTargetMachineModule = 0;
// Register the target.
static RegisterTarget<CPPTargetMachine> X("cpp", "C++ backend");

View File

@ -44,6 +44,13 @@ namespace {
};
}
/// MSILTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int MSILTargetMachineModule;
int MSILTargetMachineModule = 0;
static RegisterTarget<MSILTarget> X("msil", "MSIL backend");

View File

@ -19,6 +19,14 @@
#include "llvm/Target/TargetMachineRegistry.h"
using namespace llvm;
/// MipsTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int MipsTargetMachineModule;
int MipsTargetMachineModule = 0;
// Register the target.
static RegisterTarget<MipsTargetMachine> X("mips", "Mips");
static RegisterTarget<MipselTargetMachine> Y("mipsel", "Mipsel");

View File

@ -21,6 +21,14 @@
using namespace llvm;
/// PIC16TargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int PIC16TargetMachineModule;
int PIC16TargetMachineModule = 0;
namespace {
// Register the targets
RegisterTarget<PIC16TargetMachine> X("pic16", "PIC16 14-bit [experimental]");

View File

@ -1112,3 +1112,6 @@ namespace {
}
} Registrator;
}
extern "C" int PowerPCAsmPrinterForceLink;
int PowerPCAsmPrinterForceLink = 0;

View File

@ -21,6 +21,14 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
/// PowerPCTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int PowerPCTargetMachineModule;
int PowerPCTargetMachineModule = 0;
// Register the targets
static RegisterTarget<PPC32TargetMachine>
X("ppc32", "PowerPC 32");

View File

@ -18,6 +18,14 @@
#include "llvm/Target/TargetMachineRegistry.h"
using namespace llvm;
/// SparcTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int SparcTargetMachineModule;
int SparcTargetMachineModule = 0;
// Register the target.
static RegisterTarget<SparcTargetMachine> X("sparc", "SPARC");

View File

@ -41,3 +41,6 @@ namespace {
}
} Registrator;
}
extern "C" int X86AsmPrinterForceLink;
int X86AsmPrinterForceLink = 0;

View File

@ -18,6 +18,14 @@
#include "llvm/Target/TargetMachineRegistry.h"
using namespace llvm;
/// XCoreTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int XCoreTargetMachineModule;
int XCoreTargetMachineModule = 0;
namespace {
// Register the target.
RegisterTarget<XCoreTargetMachine> X("xcore", "XCore");