mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 19:06:02 +03:00
Readded 'relocation-model' and 'code-model' options
This commit is contained in:
parent
45426ca60d
commit
bf463d61da
3 changed files with 30 additions and 1 deletions
|
@ -242,6 +242,31 @@ cl::list<std::string> mAttrs("mattr",
|
|||
cl::opt<std::string> mTargetTriple("mtriple",
|
||||
cl::desc("Override target triple"));
|
||||
|
||||
cl::opt<llvm::Reloc::Model> mRelocModel("relocation-model",
|
||||
cl::desc("Relocation model"),
|
||||
cl::init(llvm::Reloc::Default),
|
||||
cl::values(
|
||||
clEnumValN(llvm::Reloc::Default, "default",
|
||||
"Target default relocation model"),
|
||||
clEnumValN(llvm::Reloc::Static, "static",
|
||||
"Non-relocatable code"),
|
||||
clEnumValN(llvm::Reloc::PIC_, "pic",
|
||||
"Fully relocatable, position independent code"),
|
||||
clEnumValN(llvm::Reloc::DynamicNoPIC, "dynamic-no-pic",
|
||||
"Relocatable external references, non-relocatable code"),
|
||||
clEnumValEnd));
|
||||
|
||||
cl::opt<llvm::CodeModel::Model> mCodeModel("code-model",
|
||||
cl::desc("Code model"),
|
||||
cl::init(llvm::CodeModel::Default),
|
||||
cl::values(
|
||||
clEnumValN(llvm::CodeModel::Default, "default", "Target default code model"),
|
||||
clEnumValN(llvm::CodeModel::Small, "small", "Small code model"),
|
||||
clEnumValN(llvm::CodeModel::Kernel, "kernel", "Kernel code model"),
|
||||
clEnumValN(llvm::CodeModel::Medium, "medium", "Medium code model"),
|
||||
clEnumValN(llvm::CodeModel::Large, "large", "Large code model"),
|
||||
clEnumValEnd));
|
||||
|
||||
|
||||
// "Hidden debug switches"
|
||||
// Are these ever used?
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
|
||||
namespace opts {
|
||||
namespace cl = llvm::cl;
|
||||
|
@ -43,6 +44,8 @@ namespace opts {
|
|||
extern cl::opt<std::string> mCPU;
|
||||
extern cl::list<std::string> mAttrs;
|
||||
extern cl::opt<std::string> mTargetTriple;
|
||||
extern cl::opt<llvm::Reloc::Model> mRelocModel;
|
||||
extern cl::opt<llvm::CodeModel::Model> mCodeModel;
|
||||
extern cl::opt<bool> singleObj;
|
||||
extern cl::opt<bool> linkonceTemplates;
|
||||
|
||||
|
|
|
@ -487,7 +487,8 @@ int main(int argc, char** argv)
|
|||
//assert(target.get() && "Could not allocate target machine!");
|
||||
//gTargetMachine = target.get();
|
||||
|
||||
llvm::TargetMachine* target = theTarget->createTargetMachine(triple, mCPU, FeaturesStr);
|
||||
llvm::TargetMachine* target = theTarget->createTargetMachine(triple, mCPU, FeaturesStr,
|
||||
mRelocModel, mCodeModel);
|
||||
gTargetMachine = target;
|
||||
|
||||
gTargetData = target->getTargetData();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue