diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2008-11-15 21:36:30 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2008-11-15 21:36:30 +0000 |
commit | 92adc19be95347225f713db8cc1b5e22ac08bb5e (patch) | |
tree | 3c71e3bd9d9a4dc91657ed0b6e33f1be30d72774 /lib | |
parent | 232ed2d3733b497f3a1b7a392eb0c9e60cfed228 (diff) | |
download | external_llvm-92adc19be95347225f713db8cc1b5e22ac08bb5e.zip external_llvm-92adc19be95347225f713db8cc1b5e22ac08bb5e.tar.gz external_llvm-92adc19be95347225f713db8cc1b5e22ac08bb5e.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMTargetMachine.cpp | 7 | ||||
-rw-r--r-- | lib/Target/Alpha/AlphaTargetMachine.cpp | 7 | ||||
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 8 | ||||
-rw-r--r-- | lib/Target/CellSPU/SPUTargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 | ||||
-rw-r--r-- | lib/Target/MSIL/MSILWriter.cpp | 7 | ||||
-rw-r--r-- | lib/Target/Mips/MipsTargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16TargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCTargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcTargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/Target/XCore/XCoreTargetMachine.cpp | 8 |
13 files changed, 91 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index b9c9c48..a5d3659 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/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/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index cb4dd3e..c65485b 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/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/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 6e69b9e..e8804dc 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/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/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index 5e22584..48b8583 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/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/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index b51621d..5b646ba 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/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/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index a27c0cc..0cbd011 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/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/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 25a0eaa..ff2e5b8 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/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/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp index 4a0a3b0..f2ddad1 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.cpp +++ b/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/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 6c17dbe..3043b00 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -1112,3 +1112,6 @@ namespace { } } Registrator; } + +extern "C" int PowerPCAsmPrinterForceLink; +int PowerPCAsmPrinterForceLink = 0; diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 22b459c..0ff65d2a0 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/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/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 80af77e..21c4205 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/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/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index d616acc..48ee11f 100644 --- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -41,3 +41,6 @@ namespace { } } Registrator; } + +extern "C" int X86AsmPrinterForceLink; +int X86AsmPrinterForceLink = 0; diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp index bc93880..b385304 100644 --- a/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/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"); |