[llvm-branch-commits] [llvm-branch] r111402 - in /llvm/branches/Apple/williamson: include/llvm-c/lto.h tools/gold/gold-plugin.cpp tools/lto/LTOModule.cpp tools/lto/LTOModule.h tools/lto/lto.cpp tools/lto/lto.exports
Daniel Dunbar
daniel at zuster.org
Wed Aug 18 13:33:02 PDT 2010
Author: ddunbar
Date: Wed Aug 18 15:33:01 2010
New Revision: 111402
URL: http://llvm.org/viewvc/llvm-project?rev=111402&view=rev
Log:
Merge r110604:
--
Author: Rafael Espindola <rafael.espindola at gmail.com>
Date: Mon Aug 9 21:09:46 2010 +0000
Make it possible to set the target triple and expose that with an option in the
gold plugin.
Modified:
llvm/branches/Apple/williamson/include/llvm-c/lto.h
llvm/branches/Apple/williamson/tools/gold/gold-plugin.cpp
llvm/branches/Apple/williamson/tools/lto/LTOModule.cpp
llvm/branches/Apple/williamson/tools/lto/LTOModule.h
llvm/branches/Apple/williamson/tools/lto/lto.cpp
llvm/branches/Apple/williamson/tools/lto/lto.exports
Modified: llvm/branches/Apple/williamson/include/llvm-c/lto.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/include/llvm-c/lto.h?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/include/llvm-c/lto.h (original)
+++ llvm/branches/Apple/williamson/include/llvm-c/lto.h Wed Aug 18 15:33:01 2010
@@ -135,6 +135,12 @@
extern const char*
lto_module_get_target_triple(lto_module_t mod);
+/**
+ * Sets triple string with which the object will be codegened.
+ */
+extern void
+lto_module_set_target_triple(lto_module_t mod, const char *triple);
+
/**
* Returns the number of symbols in the object module.
Modified: llvm/branches/Apple/williamson/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/tools/gold/gold-plugin.cpp?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/tools/gold/gold-plugin.cpp (original)
+++ llvm/branches/Apple/williamson/tools/gold/gold-plugin.cpp Wed Aug 18 15:33:01 2010
@@ -68,6 +68,7 @@
static std::string as_path;
static std::vector<std::string> pass_through;
static std::string extra_library_path;
+ static std::string triple;
// Additional options to pass into the code generator.
// Note: This array will contain all plugin options which are not claimed
// as plugin exclusive to pass to the code generator.
@@ -95,6 +96,8 @@
} else if (opt.startswith("pass-through=")) {
llvm::StringRef item = opt.substr(strlen("pass-through="));
pass_through.push_back(item.str());
+ } else if (opt == "mtriple=") {
+ triple = opt.substr(strlen("mtriple="));
} else if (opt == "emit-llvm") {
generate_bc_file = BC_ONLY;
} else if (opt == "also-emit-llvm") {
@@ -270,6 +273,10 @@
lto_get_error_message());
return LDPS_ERR;
}
+
+ if (!options::triple.empty())
+ lto_module_set_target_triple(cf.M, options::triple.c_str());
+
cf.handle = file->handle;
unsigned sym_count = lto_module_get_num_symbols(cf.M);
cf.syms.reserve(sym_count);
Modified: llvm/branches/Apple/williamson/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/tools/lto/LTOModule.cpp?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/tools/lto/LTOModule.cpp (original)
+++ llvm/branches/Apple/williamson/tools/lto/LTOModule.cpp Wed Aug 18 15:33:01 2010
@@ -153,6 +153,11 @@
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
Modified: llvm/branches/Apple/williamson/tools/lto/LTOModule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/tools/lto/LTOModule.h?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/tools/lto/LTOModule.h (original)
+++ llvm/branches/Apple/williamson/tools/lto/LTOModule.h Wed Aug 18 15:33:01 2010
@@ -55,6 +55,7 @@
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);
Modified: llvm/branches/Apple/williamson/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/tools/lto/lto.cpp?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/tools/lto/lto.cpp (original)
+++ llvm/branches/Apple/williamson/tools/lto/lto.cpp Wed Aug 18 15:33:01 2010
@@ -120,6 +120,14 @@
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
Modified: llvm/branches/Apple/williamson/tools/lto/lto.exports
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/williamson/tools/lto/lto.exports?rev=111402&r1=111401&r2=111402&view=diff
==============================================================================
--- llvm/branches/Apple/williamson/tools/lto/lto.exports (original)
+++ llvm/branches/Apple/williamson/tools/lto/lto.exports Wed Aug 18 15:33:01 2010
@@ -6,6 +6,7 @@
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
More information about the llvm-branch-commits
mailing list