summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2008-11-15 21:36:30 +0000
committerOscar Fuentes <ofv@wanadoo.es>2008-11-15 21:36:30 +0000
commitba4eb2a9dba43e1d4de1e5d378204a8222e1bfea (patch)
tree4f99d9355b464c7a565d1b29c0e32fc4d8cf9d71
parente132e2432a3834f6128ffe304b04ec58b415af3a (diff)
downloadbcm5719-llvm-ba4eb2a9dba43e1d4de1e5d378204a8222e1bfea.tar.gz
bcm5719-llvm-ba4eb2a9dba43e1d4de1e5d378204a8222e1bfea.zip
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! llvm-svn: 59378
-rw-r--r--llvm/lib/Target/ARM/ARMTargetMachine.cpp7
-rw-r--r--llvm/lib/Target/Alpha/AlphaTargetMachine.cpp7
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp8
-rw-r--r--llvm/lib/Target/CellSPU/SPUTargetMachine.cpp8
-rw-r--r--llvm/lib/Target/CppBackend/CPPBackend.cpp8
-rw-r--r--llvm/lib/Target/MSIL/MSILWriter.cpp7
-rw-r--r--llvm/lib/Target/Mips/MipsTargetMachine.cpp8
-rw-r--r--llvm/lib/Target/PIC16/PIC16TargetMachine.cpp8
-rw-r--r--llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp3
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp8
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetMachine.cpp8
-rw-r--r--llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp3
-rw-r--r--llvm/lib/Target/XCore/XCoreTargetMachine.cpp8
13 files changed, 91 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index b9c9c486005..a5d3659d3c7 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -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");
diff --git a/llvm/lib/Target/Alpha/AlphaTargetMachine.cpp b/llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
index cb4dd3ea1fa..c65485b061c 100644
--- a/llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
+++ b/llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
@@ -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]");
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index 6e69b9e2495..e8804dcad27 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/lib/Target/CBackend/CBackend.cpp
@@ -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");
diff --git a/llvm/lib/Target/CellSPU/SPUTargetMachine.cpp b/llvm/lib/Target/CellSPU/SPUTargetMachine.cpp
index 5e225844dbb..48b85832e58 100644
--- a/llvm/lib/Target/CellSPU/SPUTargetMachine.cpp
+++ b/llvm/lib/Target/CellSPU/SPUTargetMachine.cpp
@@ -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>
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp
index b51621d882a..5b646bac3ee 100644
--- a/llvm/lib/Target/CppBackend/CPPBackend.cpp
+++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp
@@ -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");
diff --git a/llvm/lib/Target/MSIL/MSILWriter.cpp b/llvm/lib/Target/MSIL/MSILWriter.cpp
index a27c0cc688a..0cbd01117e5 100644
--- a/llvm/lib/Target/MSIL/MSILWriter.cpp
+++ b/llvm/lib/Target/MSIL/MSILWriter.cpp
@@ -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");
diff --git a/llvm/lib/Target/Mips/MipsTargetMachine.cpp b/llvm/lib/Target/Mips/MipsTargetMachine.cpp
index 25a0eaa857c..ff2e5b81589 100644
--- a/llvm/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/llvm/lib/Target/Mips/MipsTargetMachine.cpp
@@ -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");
diff --git a/llvm/lib/Target/PIC16/PIC16TargetMachine.cpp b/llvm/lib/Target/PIC16/PIC16TargetMachine.cpp
index 4a0a3b01c81..f2ddad14bf2 100644
--- a/llvm/lib/Target/PIC16/PIC16TargetMachine.cpp
+++ b/llvm/lib/Target/PIC16/PIC16TargetMachine.cpp
@@ -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]");
diff --git a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index 6c17dbece07..3043b0098b4 100644
--- a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -1112,3 +1112,6 @@ namespace {
}
} Registrator;
}
+
+extern "C" int PowerPCAsmPrinterForceLink;
+int PowerPCAsmPrinterForceLink = 0;
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index 22b459cb748..0ff65d2a0d3 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -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");
diff --git a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
index 80af77e6808..21c4205b37d 100644
--- a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
+++ b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
@@ -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");
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index d616accbc3f..48ee11f5a9d 100644
--- a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -41,3 +41,6 @@ namespace {
}
} Registrator;
}
+
+extern "C" int X86AsmPrinterForceLink;
+int X86AsmPrinterForceLink = 0;
diff --git a/llvm/lib/Target/XCore/XCoreTargetMachine.cpp b/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
index bc93880217c..b3853044bb9 100644
--- a/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
+++ b/llvm/lib/Target/XCore/XCoreTargetMachine.cpp
@@ -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");
OpenPOWER on IntegriCloud