diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-05-27 15:15:58 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-05-27 15:15:58 +0000 |
commit | 1e3dec662ea18131c495db50caccc57f77b7a5fe (patch) | |
tree | 9fad9a5d5dd8c4ff54af48edad9c8cc26dd5fda1 /tools/gold/gold-plugin.cpp | |
parent | 377552607e51dc1d3e6ff33833f9620bcfe815ac (diff) | |
download | FreeBSD-src-1e3dec662ea18131c495db50caccc57f77b7a5fe.zip FreeBSD-src-1e3dec662ea18131c495db50caccc57f77b7a5fe.tar.gz |
Update LLVM to r104832.
Diffstat (limited to 'tools/gold/gold-plugin.cpp')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 16e645f..2e5c179 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -59,6 +59,7 @@ namespace { namespace options { static bool generate_api_file = false; + static std::string bc_path; static const char *as_path = NULL; // Additional options to pass into the code generator. // Note: This array will contain all plugin options which are not claimed @@ -81,6 +82,14 @@ namespace options { } else { as_path = strdup(opt + 3); } + } else if(llvm::StringRef(opt).startswith("also-emit-llvm=")) { + const char *path = opt + strlen("also-emit-llvm="); + if (bc_path != "") { + (*message)(LDPL_WARNING, "Path to the output IL file specified twice. " + "Discarding %s", opt); + } else { + bc_path = path; + } } else { // Save this option to pass to the code generator. extra.push_back(std::string(opt)); @@ -374,6 +383,11 @@ static ld_plugin_status all_symbols_read_hook(void) { } } + if (options::bc_path != "") { + bool err = lto_codegen_write_merged_modules(cg, options::bc_path.c_str()); + if (err) + (*message)(LDPL_FATAL, "Failed to write the output file."); + } size_t bufsize = 0; const char *buffer = static_cast<const char *>(lto_codegen_compile(cg, &bufsize)); |