aboutsummaryrefslogtreecommitdiff
path: root/tools/lto
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-08-09 21:09:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-08-09 21:09:46 +0000
commitcbb170d057aa6692b19f577b1e09a6c1c7a26969 (patch)
tree5d9b5d43beeb4376d21195edc7f2a0389c74aa70 /tools/lto
parent3221834f8a6216d01a7e1d1201bd14eafd79cff3 (diff)
Make it possible to set the target triple and expose that with an option in the
gold plugin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/LTOModule.cpp5
-rw-r--r--tools/lto/LTOModule.h1
-rw-r--r--tools/lto/lto.cpp8
-rw-r--r--tools/lto/lto.exports1
4 files changed, 15 insertions, 0 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 0870205a77..d386bacdfc 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -153,6 +153,11 @@ const char* LTOModule::getTargetTriple()
return _module->getTargetTriple().c_str();
}
+void LTOModule::setTargetTriple(const char *triple)
+{
+ _module->setTargetTriple(triple);
+}
+
void LTOModule::addDefinedFunctionSymbol(Function* f, Mangler &mangler)
{
// add to list of defined symbols
diff --git a/tools/lto/LTOModule.h b/tools/lto/LTOModule.h
index 7f475d40aa..a19acc0d73 100644
--- a/tools/lto/LTOModule.h
+++ b/tools/lto/LTOModule.h
@@ -55,6 +55,7 @@ struct LTOModule {
std::string& errMsg);
const char* getTargetTriple();
+ void setTargetTriple(const char*);
uint32_t getSymbolCount();
lto_symbol_attributes getSymbolAttributes(uint32_t index);
const char* getSymbolName(uint32_t index);
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index cc841bdf03..a299dd187d 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -120,6 +120,14 @@ const char* lto_module_get_target_triple(lto_module_t mod)
return mod->getTargetTriple();
}
+//
+// sets triple string with which the object will be codegened.
+//
+void lto_module_set_target_triple(lto_module_t mod, const char *triple)
+{
+ return mod->setTargetTriple(triple);
+}
+
//
// returns the number of symbols in the object module
diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports
index 9011cf602b..a686b78845 100644
--- a/tools/lto/lto.exports
+++ b/tools/lto/lto.exports
@@ -6,6 +6,7 @@ lto_module_get_num_symbols
lto_module_get_symbol_attribute
lto_module_get_symbol_name
lto_module_get_target_triple
+lto_module_set_target_triple
lto_module_is_object_file
lto_module_is_object_file_for_target
lto_module_is_object_file_in_memory