summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mc/llvm-mc.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-07-19 06:37:02 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-07-19 06:37:02 +0000
commit2129f596379548d52745fc5906d86361a811ed08 (patch)
tree41c6f7de43be662e0e883ddc70a91d9cd3da2016 /llvm/tools/llvm-mc/llvm-mc.cpp
parenta63d08c9ff246e83ea61f1ae7eafe41d37035d45 (diff)
downloadbcm5719-llvm-2129f596379548d52745fc5906d86361a811ed08.tar.gz
bcm5719-llvm-2129f596379548d52745fc5906d86361a811ed08.zip
Introduce MCCodeGenInfo, which keeps information that can affect codegen
(including compilation, assembly). Move relocation model Reloc::Model from TargetMachine to MCCodeGenInfo so it's accessible even without TargetMachine. llvm-svn: 135468
Diffstat (limited to 'llvm/tools/llvm-mc/llvm-mc.cpp')
-rw-r--r--llvm/tools/llvm-mc/llvm-mc.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 1633ae31471..e2de05542b7 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -111,6 +111,21 @@ MCPU("mcpu",
cl::value_desc("cpu-name"),
cl::init(""));
+static cl::opt<Reloc::Model>
+RelocModel("relocation-model",
+ cl::desc("Choose relocation model"),
+ cl::init(Reloc::Default),
+ cl::values(
+ clEnumValN(Reloc::Default, "default",
+ "Target default relocation model"),
+ clEnumValN(Reloc::Static, "static",
+ "Non-relocatable code"),
+ clEnumValN(Reloc::PIC_, "pic",
+ "Fully relocatable, position independent code"),
+ clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
+ "Relocatable external references, non-relocatable code"),
+ clEnumValEnd));
+
static cl::opt<bool>
NoInitialTextSection("n", cl::desc("Don't assume assembly file starts "
"in the text section"));
@@ -321,7 +336,8 @@ static int AssembleInput(const char *ProgName) {
// the .cpu and .code16 directives).
OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(TripleName,
MCPU,
- FeaturesStr));
+ FeaturesStr,
+ RelocModel));
if (!TM) {
errs() << ProgName << ": error: could not create target for triple '"
@@ -440,6 +456,7 @@ int main(int argc, char **argv) {
// FIXME: We shouldn't need to initialize the Target(Machine)s.
llvm::InitializeAllTargets();
llvm::InitializeAllMCAsmInfos();
+ llvm::InitializeAllMCCodeGenInfos();
llvm::InitializeAllMCInstrInfos();
llvm::InitializeAllMCRegisterInfos();
llvm::InitializeAllMCSubtargetInfos();
OpenPOWER on IntegriCloud