diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-08-09 21:09:46 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-08-09 21:09:46 +0000 |
commit | cbb170d057aa6692b19f577b1e09a6c1c7a26969 (patch) | |
tree | 5d9b5d43beeb4376d21195edc7f2a0389c74aa70 /tools/gold/gold-plugin.cpp | |
parent | 3221834f8a6216d01a7e1d1201bd14eafd79cff3 (diff) | |
download | external_llvm-cbb170d057aa6692b19f577b1e09a6c1c7a26969.zip external_llvm-cbb170d057aa6692b19f577b1e09a6c1c7a26969.tar.gz external_llvm-cbb170d057aa6692b19f577b1e09a6c1c7a26969.tar.bz2 |
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/gold/gold-plugin.cpp')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2d0f5bd..e7161a6 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -68,6 +68,7 @@ namespace options { 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 @@ namespace options { } 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 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, 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); |