diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-08-26 15:29:47 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-08-26 15:29:47 -0700 |
commit | b1138c189de88ac0dae968661a4977e3ad257c79 (patch) | |
tree | c69512843f92a39875989688e1fc3230497b8f9a | |
parent | 685d11b718cf8a017665f241f45fc144e8d622f2 (diff) |
Revert LOCALMODs in gold plugin and libLTO related to bitcode shared objects and symbol wrapping
This reverts the local modifications to the gold plugin and liblto for
bitcode shared objects and for symbol wrapping, neither of which are used or tested anymore. It depends
on a corresponding change to the linker plugin API.
R=eliben@chromium.org, jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3520
Review URL: https://codereview.chromium.org/22831032
-rw-r--r-- | include/llvm-c/lto.h | 100 | ||||
-rw-r--r-- | tools/gold/gold-plugin.cpp | 204 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 78 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.h | 10 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 32 | ||||
-rw-r--r-- | tools/lto/LTOModule.h | 8 | ||||
-rw-r--r-- | tools/lto/lto.cpp | 131 | ||||
-rw-r--r-- | tools/lto/lto.exports | 15 |
8 files changed, 6 insertions, 572 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h index 078502b3e6..40110fddfc 100644 --- a/include/llvm-c/lto.h +++ b/include/llvm-c/lto.h @@ -60,13 +60,6 @@ typedef enum { LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC = 2 } lto_codegen_model; -/* @LOCALMOD-BEGIN */ -typedef enum { - LTO_OUTPUT_FORMAT_OBJECT = 0, /* object file */ - LTO_OUTPUT_FORMAT_SHARED = 1, /* shared library */ - LTO_OUTPUT_FORMAT_EXEC = 2 /* executable */ -} lto_output_format; -/* @LOCALMOD-END */ /** opaque reference to a loaded object module */ typedef struct LTOModule* lto_module_t; @@ -78,17 +71,6 @@ typedef struct LTOCodeGenerator* lto_code_gen_t; extern "C" { #endif - -/* @LOCALMOD-BEGIN */ - -/* Add a command-line option */ -void lto_add_command_line_option(const char* opt); - -/* Parse command line options */ -void lto_parse_command_line_options(); - -/* @LOCALMOD-END */ - /** * Returns a printable string. */ @@ -183,36 +165,6 @@ lto_module_get_target_triple(lto_module_t mod); extern void lto_module_set_target_triple(lto_module_t mod, const char *triple); -/* @LOCALMOD-BEGIN */ - -/** - * Get the module format for this module - */ -extern lto_output_format -lto_module_get_output_format(lto_module_t mod); - -/** - * Get the module soname - */ -extern const char* -lto_module_get_soname(lto_module_t mod); - - -/** - * Get the i'th library dependency. - * Returns NULL if i >= lto_module_get_num_library_deps() - */ -extern const char* -lto_module_get_library_dep(lto_module_t mod, unsigned int i); - - -/** - * Return the number of library dependencies of this module. - */ -extern unsigned int -lto_module_get_num_library_deps(lto_module_t mod); - -/* @LOCALMOD-END */ /** * Returns the number of symbols in the object module. @@ -259,6 +211,8 @@ lto_codegen_dispose(lto_code_gen_t); extern bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod); + + /** * Sets if debug info should be generated. * Returns true on error (check lto_get_error_message() for details). @@ -304,56 +258,6 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args, extern void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol); -/* @LOCALMOD-BEGIN */ - -/** - * Sets the module type for the merged module - */ -extern void -lto_codegen_set_merged_module_output_format(lto_code_gen_t cg, - lto_output_format format); - -/** - * Sets the SOName for the merged module - */ -extern void -lto_codegen_set_merged_module_soname(lto_code_gen_t cg, - const char *soname); - -/** - * Add a library dependency to the merged module - */ -extern void -lto_codegen_add_merged_module_library_dep(lto_code_gen_t cg, - const char *lib); - -/** - * Wrap a symbol in the merged module. - */ -extern void -lto_codegen_wrap_symbol_in_merged_module(lto_code_gen_t cg, - const char *sym); - - -/** - * Set version of a defined symbol in the merged module - */ -extern const char * -lto_codegen_set_symbol_def_version(lto_code_gen_t cg, - const char *sym, - const char *version, - bool is_default); - - -/** - * Set version of an undefined symbol in the merged module - */ -extern const char * -lto_codegen_set_symbol_needed(lto_code_gen_t cg, - const char *sym, - const char *version, - const char *dynfile); -/* @LOCALMOD-END */ /** * Writes a new object file at the specified path that contains the * merged contents of all modules added so far. diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2ea45dd9d3..40f5fd6086 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -52,25 +52,6 @@ namespace { ld_plugin_set_extra_library_path set_extra_library_path = NULL; ld_plugin_get_view get_view = NULL; ld_plugin_message message = discard_message; - // @LOCALMOD-BEGIN - // REL, DYN, or EXEC - ld_plugin_output_file_type linker_output; - - // Callback for getting link soname from gold - ld_plugin_get_output_soname get_output_soname = NULL; - - // Callback for getting needed libraries from gold - ld_plugin_get_needed get_needed = NULL; - - // Callback for getting number of needed library from gold - ld_plugin_get_num_needed get_num_needed = NULL; - - // Callback for getting the number of --wrap'd symbols. - ld_plugin_get_num_wrapped get_num_wrapped = NULL; - - // Callback for getting the name of a wrapped symbol. - ld_plugin_get_wrapped get_wrapped = NULL; - // @LOCALMOD-END int api_version = 0; int gold_version = 0; @@ -78,17 +59,11 @@ namespace { struct claimed_file { void *handle; std::vector<ld_plugin_symbol> syms; - bool is_linked_in; // @LOCALMOD }; lto_codegen_model output_type = LTO_CODEGEN_PIC_MODEL_STATIC; std::string output_name = ""; std::list<claimed_file> Modules; - - // @LOCALMOD-BEGIN - std::vector<std::string> DepLibs; - // @LOCALMOD-END - std::vector<sys::Path> Cleanup; lto_code_gen_t code_gen = NULL; } @@ -145,18 +120,6 @@ namespace options { } } -// @LOCALMOD-BEGIN -static const char *get_basename(const char *path) { - if (path == NULL) - return NULL; - const char *slash = strrchr(path, '/'); - if (slash) - return slash + 1; - - return path; -} -// @LOCALMOD-END - static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, int *claimed); static ld_plugin_status all_symbols_read_hook(void); @@ -184,10 +147,6 @@ ld_plugin_status onload(ld_plugin_tv *tv) { output_name = tv->tv_u.tv_string; break; case LDPT_LINKER_OUTPUT: - // @LOCALMOD-BEGIN - linker_output = - static_cast<ld_plugin_output_file_type>(tv->tv_u.tv_val); - // @LOCALMOD-END switch (tv->tv_u.tv_val) { case LDPO_REL: // .o case LDPO_DYN: // .so @@ -251,23 +210,7 @@ ld_plugin_status onload(ld_plugin_tv *tv) { break; case LDPT_GET_VIEW: get_view = tv->tv_u.tv_get_view; - // @LOCALMOD-BEGIN - case LDPT_GET_OUTPUT_SONAME: - get_output_soname = tv->tv_u.tv_get_output_soname; - break; - case LDPT_GET_NEEDED: - get_needed = tv->tv_u.tv_get_needed; - break; - case LDPT_GET_NUM_NEEDED: - get_num_needed = tv->tv_u.tv_get_num_needed; - break; - case LDPT_GET_WRAPPED: - get_wrapped = tv->tv_u.tv_get_wrapped; break; - case LDPT_GET_NUM_WRAPPED: - get_num_wrapped = tv->tv_u.tv_get_num_wrapped; - break; - // @LOCALMOD-END case LDPT_MESSAGE: message = tv->tv_u.tv_message; break; @@ -285,24 +228,6 @@ ld_plugin_status onload(ld_plugin_tv *tv) { return LDPS_ERR; } - // @LOCALMOD-BEGIN - // Parse extra command-line options - // Although lto_codegen provides a way to parse command-line arguments, - // we need the arguments to be parsed and applied before LTOModules are - // even created. In particular, this is needed because the - // "-add-nacl-read-tp-dependency" flag affects how modules are created. - if (!options::extra.empty()) { - for (std::vector<std::string>::iterator it = options::extra.begin(); - it != options::extra.end(); ++it) { - lto_add_command_line_option((*it).c_str()); - } - lto_parse_command_line_options(); - // We clear the options so that they don't get parsed again in - // lto_codegen_debug_options. - options::extra.clear(); - } - // @LOCALMOD-END - return LDPS_OK; } @@ -369,21 +294,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, ld_plugin_symbol &sym = cf.syms.back(); sym.name = const_cast<char *>(lto_module_get_symbol_name(M, i)); sym.name = strdup(sym.name); - // @LOCALMOD-BEGIN - // Localmods have disabled the use of the 'version' field for passing - // version information to Gold. Instead, the version is now transmitted as - // part of the 'name' field, which has the form "sym@VER" or "sym@@VER". - // This is nicer because it communicates one extra bit of information (@@ - // marks the default version), and allows us to access the real symbol - // name in all_symbols_read. - - // These fields are set by Gold to communicate the updated version info - // to the plugin. They are used in all_symbols_read_hook(). - // Initialize them for predictability. sym.version = NULL; - sym.is_default = false; - sym.dynfile = NULL; - // @LOCALMOD-END int scope = attrs & LTO_SYMBOL_SCOPE_MASK; switch (scope) { @@ -432,36 +343,16 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, } cf.syms.reserve(cf.syms.size()); - // @LOCALMOD-BEGIN - bool is_shared = - (lto_module_get_output_format(M) == LTO_OUTPUT_FORMAT_SHARED); - const char* soname = lto_module_get_soname(M); - if (soname[0] == '\0') - soname = NULL; - // @LOCALMOD-END if (!cf.syms.empty()) { - if ((*add_symbols)(cf.handle, cf.syms.size(), &cf.syms[0], - is_shared, soname) != LDPS_OK) { // @LOCALMOD + if ((*add_symbols)(cf.handle, cf.syms.size(), &cf.syms[0]) != LDPS_OK) { (*message)(LDPL_ERROR, "Unable to add symbols!"); return LDPS_ERR; } } - // @LOCALMOD-BEGIN - // Do not merge the module if it's a PSO. - // If the PSO's soname is set, add it to DepLibs. - cf.is_linked_in = false; - if (code_gen) { - if (is_shared) { - if (soname && strlen(soname) > 0) { - DepLibs.push_back(soname); - } - } else { - lto_codegen_add_module(code_gen, M); - cf.is_linked_in = true; - } - } + if (code_gen) + lto_codegen_add_module(code_gen, M); lto_module_dispose(M); @@ -490,45 +381,12 @@ static ld_plugin_status all_symbols_read_hook(void) { continue; (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]); for (unsigned i = 0, e = I->syms.size(); i != e; i++) { - // @LOCALMOD-BEGIN - // Don't process the symbols inside a dynamic object. - if (!I->is_linked_in) - continue; - // @LOCALMOD-END - if (I->syms[i].resolution == LDPR_PREVAILING_DEF) { - // @LOCALMOD-BEGIN - // Set the symbol version in the module. - if (linker_output != LDPO_REL && I->syms[i].version) { - // NOTE: This may change the name of the symbol, so it must happen - // before the call to lto_codegen_add_must_preserve_symbols() below. - I->syms[i].name = const_cast<char *>( - lto_codegen_set_symbol_def_version(code_gen, I->syms[i].name, - I->syms[i].version, - I->syms[i].is_default)); - } lto_codegen_add_must_preserve_symbol(code_gen, I->syms[i].name); - // @LOCALMOD-END if (options::generate_api_file) api_file << I->syms[i].name << "\n"; } - // @LOCALMOD-BEGIN - else if (linker_output != LDPO_REL && - (I->syms[i].resolution == LDPR_RESOLVED_DYN || - I->syms[i].resolution == LDPR_UNDEF)) { - // This symbol is provided by an external object. - // Set the version and source dynamic file for it. - const char *ver = I->syms[i].version; - const char *dynfile = I->syms[i].dynfile; - dynfile = get_basename(dynfile); - // NOTE: This may change the name of the symbol. - I->syms[i].name = const_cast<char *>( - lto_codegen_set_symbol_needed(code_gen, I->syms[i].name, - ver ? ver : "", - dynfile ? dynfile : "")); - } - // @LOCALMOD-END } } @@ -540,11 +398,6 @@ static ld_plugin_status all_symbols_read_hook(void) { if (!options::mcpu.empty()) lto_codegen_set_cpu(code_gen, options::mcpu.c_str()); - // @LOCALMOD-BEGIN (COMMENT) - // "extra" will always be empty below, because we process the extra - // options earlier, at the end of onload(). - // @LOCALMOD-END - // Pass through extra options to the code generator. if (!options::extra.empty()) { for (std::vector<std::string>::iterator it = options::extra.begin(); @@ -553,57 +406,6 @@ static ld_plugin_status all_symbols_read_hook(void) { } } - // @LOCALMOD-BEGIN - // Store the linker output format into the bitcode. - lto_output_format format; - switch (linker_output) { - case LDPO_REL: - format = LTO_OUTPUT_FORMAT_OBJECT; - break; - case LDPO_DYN: - format = LTO_OUTPUT_FORMAT_SHARED; - break; - case LDPO_EXEC: - format = LTO_OUTPUT_FORMAT_EXEC; - break; - default: - (*message)(LDPL_FATAL, "Unknown linker output format (gold-plugin)"); - abort(); - break; - } - lto_codegen_set_merged_module_output_format(code_gen, format); - // @LOCALMOD-END - - // @LOCALMOD-BEGIN - // For -shared linking, store the soname into the bitcode. - if (linker_output == LDPO_DYN) { - const char *soname = (*get_output_soname)(); - lto_codegen_set_merged_module_soname(code_gen, soname); - } - // @LOCALMOD-END - - // @LOCALMOD-BEGIN - // Add the needed libraries to the bitcode. - unsigned int num_needed = (*get_num_needed)(); - for (unsigned i=0; i < num_needed; ++i) { - const char *soname = (*get_needed)(i); - soname = get_basename(soname); - lto_codegen_add_merged_module_library_dep(code_gen, soname); - } - for (std::vector<std::string>::iterator I = DepLibs.begin(), - E = DepLibs.end(); I != E; ++I) { - lto_codegen_add_merged_module_library_dep(code_gen, I->c_str()); - } - // @LOCALMOD-END - - // @LOCALMOD-BEGIN - // Perform symbol wrapping. - unsigned int num_wrapped = (*get_num_wrapped)(); - for (unsigned i=0; i < num_wrapped; ++i) { - const char *sym = (*get_wrapped)(i); - lto_codegen_wrap_symbol_in_merged_module(code_gen, sym); - } - // @LOCALMOD-END if (options::generate_bc_file != options::BC_NO) { std::string path; if (options::generate_bc_file == options::BC_ONLY) diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index b716da5707..57e7a2d07f 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -124,83 +124,6 @@ bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model, llvm_unreachable("Unknown PIC model!"); } -// @LOCALMOD-BEGIN -void LTOCodeGenerator::setMergedModuleOutputFormat(lto_output_format format) -{ - Module::OutputFormat outputFormat; - switch (format) { - case LTO_OUTPUT_FORMAT_OBJECT: - outputFormat = Module::ObjectOutputFormat; - break; - case LTO_OUTPUT_FORMAT_SHARED: - outputFormat = Module::SharedOutputFormat; - break; - case LTO_OUTPUT_FORMAT_EXEC: - outputFormat = Module::ExecutableOutputFormat; - break; - default: - llvm_unreachable("Unexpected output format"); - } - Module *mergedModule = _linker.getModule(); - mergedModule->setOutputFormat(outputFormat); -} - -void LTOCodeGenerator::setMergedModuleSOName(const char *soname) -{ - Module *mergedModule = _linker.getModule(); - mergedModule->setSOName(soname); -} - -void LTOCodeGenerator::addLibraryDep(const char *lib) -{ - Module *mergedModule = _linker.getModule(); - mergedModule->addLibrary(lib); -} - -void LTOCodeGenerator::wrapSymbol(const char *sym) -{ - Module *mergedModule = _linker.getModule(); - mergedModule->wrapSymbol(sym); -} - -const char* LTOCodeGenerator::setSymbolDefVersion(const char *sym, - const char *ver, - bool is_default) -{ - Module *mergedModule = _linker.getModule(); - GlobalValue *GV = mergedModule->getNamedValue(sym); - if (!GV) { - llvm_unreachable("Invalid global in setSymbolDefVersion"); - } - GV->setVersionDef(ver, is_default); - return strdup(GV->getName().str().c_str()); -} - -const char* LTOCodeGenerator::setSymbolNeeded(const char *sym, - const char *ver, - const char *dynfile) -{ - Module *mergedModule = _linker.getModule(); - GlobalValue *GV = mergedModule->getNamedValue(sym); - if (!GV) { - // Symbol lookup may have failed because this symbol was already - // renamed for versioning. Make sure this is the case. - if (strchr(sym, '@') != NULL || ver == NULL || ver[0] == '\0') { - llvm_unreachable("Unexpected condition in setSymbolNeeded"); - } - std::string NewName = std::string(sym) + "@" + ver; - GV = mergedModule->getNamedValue(NewName); - } - if (!GV) { - // Ignore failures due to unused declarations. - // This caused a falure to build libppruntime.so for glibc. - // TODO(sehr): better document under which circumstances this is needed. - return sym; - } - GV->setNeeded(ver, dynfile); - return strdup(GV->getName().str().c_str()); -} -// @LOCALMOD-END bool LTOCodeGenerator::writeMergedModules(const char *path, std::string &errMsg) { if (determineTarget(errMsg)) @@ -219,6 +142,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path, return true; } + // write bitcode to it WriteBitcodeToFile(_linker.getModule(), Out.os()); Out.os().close(); diff --git a/tools/lto/LTOCodeGenerator.h b/tools/lto/LTOCodeGenerator.h index 5a78488e29..a4ade9fd26 100644 --- a/tools/lto/LTOCodeGenerator.h +++ b/tools/lto/LTOCodeGenerator.h @@ -51,16 +51,6 @@ struct LTOCodeGenerator { } bool writeMergedModules(const char *path, std::string &errMsg); - // @LOCALMOD-BEGIN - void setMergedModuleOutputFormat(lto_output_format format); - void setMergedModuleSOName(const char *soname); - void addLibraryDep(const char *lib); - void wrapSymbol(const char *sym); - const char* setSymbolDefVersion(const char *sym, const char *ver, - bool is_default); - const char* setSymbolNeeded(const char *sym, const char *ver, - const char *dynfile); - // @LOCALMOD-END bool compile_to_file(const char **name, std::string &errMsg); const void *compile(size_t *length, std::string &errMsg); void setCodeGenDebugOptions(const char *opts); diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 2f98517c1c..fce0bb062a 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -305,7 +305,6 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer, getTargetOptions(Options); TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr, Options); - LTOModule *Ret = new LTOModule(m.take(), target); if (Ret->parseSymbols(errMsg)) { delete Ret; @@ -321,36 +320,6 @@ MemoryBuffer *LTOModule::makeBuffer(const void *mem, size_t length) { return MemoryBuffer::getMemBuffer(StringRef(startPtr, length), "", false); } -// @LOCALMOD-BEGIN -lto_output_format LTOModule::getOutputFormat() { - Module::OutputFormat format = _module->getOutputFormat(); - switch (format) { - case Module::ObjectOutputFormat: return LTO_OUTPUT_FORMAT_OBJECT; - case Module::SharedOutputFormat: return LTO_OUTPUT_FORMAT_SHARED; - case Module::ExecutableOutputFormat: return LTO_OUTPUT_FORMAT_EXEC; - } - llvm_unreachable("Unknown output format in LTOModule"); -} - -const char *LTOModule::getSOName() { - return _module->getSOName().c_str(); -} - -const char* LTOModule::getLibraryDep(uint32_t index) { - /* make it compile until we bring back deplibs - const Module::LibraryListType &Libs = _module->getLibraries(); - if (index < Libs.size()) - return Libs[index].c_str(); - */ - return NULL; -} - -uint32_t LTOModule::getNumLibraryDeps() { - //return _module->getLibraries().size(); - return 0; -} -// @LOCALMOD-END - /// objcClassNameFromExpression - Get string that the data pointer points to. bool LTOModule::objcClassNameFromExpression(const Constant *c, std::string &name) { @@ -840,7 +809,6 @@ namespace { unsigned MaxBytesToEmit) {} virtual bool EmitValueToOffset(const MCExpr *Offset, unsigned char Value ) { return false; } - virtual void EmitFileDirective(StringRef Filename) {} virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel, diff --git a/tools/lto/LTOModule.h b/tools/lto/LTOModule.h index 6f97699e90..83f3a7def1 100644 --- a/tools/lto/LTOModule.h +++ b/tools/lto/LTOModule.h @@ -99,14 +99,6 @@ public: _module->setTargetTriple(triple); } - // @LOCALMOD-BEGIN - lto_output_format getOutputFormat(); - const char* getSOName(); - const char* getLibraryDep(uint32_t index); - uint32_t getNumLibraryDeps(); - // @LOCALMOD-END - - /// getSymbolCount - Get the number of symbols uint32_t getSymbolCount() { return _symbols.size(); diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 11d54c6a9d..11ad532be8 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -13,8 +13,6 @@ //===----------------------------------------------------------------------===// #include "llvm-c/lto.h" -#include "llvm/Support/CommandLine.h" // @LOCALMOD - #include "LTOCodeGenerator.h" #include "LTOModule.h" #include "llvm-c/Core.h" @@ -24,25 +22,6 @@ // *** Not thread safe *** static std::string sLastErrorString; -// @LOCALMOD-BEGIN -static std::vector<const char*> lto_options; -extern void lto_add_command_line_option(const char* opt) -{ - // ParseCommandLineOptions() expects argv[0] to be program name. - if (lto_options.empty()) - lto_options.push_back("libLTO"); - - lto_options.push_back(strdup(opt)); -} - -extern void lto_parse_command_line_options() -{ - if ( !lto_options.empty() ) - llvm::cl::ParseCommandLineOptions(lto_options.size(), - const_cast<char **>(<o_options[0])); -} -// @LOCALMOD-END - /// lto_get_version - Returns a printable string. extern const char* lto_get_version() { return LTOCodeGenerator::getVersionString(); @@ -127,45 +106,6 @@ void lto_module_set_target_triple(lto_module_t mod, const char *triple) { return mod->setTargetTriple(triple); } -// @LOCALMOD-BEGIN - -// -// Get the module format for this module -// -lto_output_format lto_module_get_output_format(lto_module_t mod) -{ - return mod->getOutputFormat(); -} - -// -// Get the module soname -// -const char* lto_module_get_soname(lto_module_t mod) -{ - return mod->getSOName(); -} - -// -// Get the i'th library dependency. -// Returns NULL if i >= lto_module_get_num_library_deps() -// -const char * -lto_module_get_library_dep(lto_module_t mod, unsigned int i) -{ - return mod->getLibraryDep(i); -} - -// -// Return the number of library dependencies of this module. -// -unsigned int -lto_module_get_num_library_deps(lto_module_t mod) -{ - return mod->getNumLibraryDeps(); -} - -// @LOCALMOD-END - /// lto_module_get_num_symbols - Returns the number of symbols in the object /// module. unsigned int lto_module_get_num_symbols(lto_module_t mod) { @@ -242,77 +182,6 @@ void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, cg->addMustPreserveSymbol(symbol); } -// @LOCALMOD-BEGIN - -// -// Set the module format for the merged module -// -void lto_codegen_set_merged_module_output_format(lto_code_gen_t cg, - lto_output_format format) -{ - cg->setMergedModuleOutputFormat(format); -} - -// -// Set the module soname (for shared library bitcode) -// -void lto_codegen_set_merged_module_soname(lto_code_gen_t cg, - const char* soname) -{ - cg->setMergedModuleSOName(soname); -} - -// -// Add a library dependency to the linked bitcode module. -// -void lto_codegen_add_merged_module_library_dep(lto_code_gen_t cg, - const char* soname) -{ - cg->addLibraryDep(soname); -} - -// -// Apply symbol wrapping in the linked bitcode module. -// -void lto_codegen_wrap_symbol_in_merged_module(lto_code_gen_t cg, - const char* sym) { - cg->wrapSymbol(sym); -} - -// -// Set the symbol version of defined symbol 'sym'. -// 'sym' is the name of the GlobalValue, exactly as it is -// in the LLVM module. It may already have a version suffix. -// In that case, this function verifies that the old version -// and new version match. -// Returns a reference to the new name. -// -const char * -lto_codegen_set_symbol_def_version(lto_code_gen_t cg, - const char *sym, - const char *version, - bool is_default) { - return cg->setSymbolDefVersion(sym, version, is_default); -} - -// -// Set the symbol version of needed symbol 'sym' from file 'dynfile'. -// 'sym' is the name of the GlobalValue, exactly as it is -// in the LLVM module. It may already have a version suffix. -// In that case, this function verifies that the old version -// and new version match. -// In any case, it adds a NeededRecord entry. -// Returns a reference to the new name. -// -const char* -lto_codegen_set_symbol_needed(lto_code_gen_t cg, - const char *sym, - const char *version, - const char *dynfile) { - return cg->setSymbolNeeded(sym, version, dynfile); -} -// @LOCALMOD-END - /// lto_codegen_write_merged_modules - Writes a new file at the specified path /// that contains the merged contents of all modules added so far. Returns true /// on error (check lto_get_error_message() for details). diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports index 596d2d6ec3..46d0d74c82 100644 --- a/tools/lto/lto.exports +++ b/tools/lto/lto.exports @@ -1,5 +1,3 @@ -lto_add_command_line_option -lto_parse_command_line_options lto_get_error_message lto_get_version lto_initialize_disassembler @@ -12,10 +10,6 @@ lto_module_get_symbol_attribute lto_module_get_symbol_name lto_module_get_target_triple lto_module_set_target_triple -lto_module_get_output_format -lto_module_get_soname -lto_module_get_library_dep -lto_module_get_num_library_deps lto_module_is_object_file lto_module_is_object_file_for_target lto_module_is_object_file_in_memory @@ -26,9 +20,6 @@ lto_codegen_add_must_preserve_symbol lto_codegen_compile lto_codegen_create lto_codegen_dispose -lto_codegen_set_assembler_args -lto_codegen_set_assembler_path -lto_codegen_set_cpu lto_codegen_set_debug_model lto_codegen_set_pic_model lto_codegen_write_merged_modules @@ -36,12 +27,6 @@ lto_codegen_debug_options lto_codegen_set_assembler_args lto_codegen_set_assembler_path lto_codegen_set_cpu -lto_codegen_set_merged_module_output_format -lto_codegen_set_merged_module_soname -lto_codegen_add_merged_module_library_dep -lto_codegen_set_symbol_def_version -lto_codegen_set_symbol_needed -lto_codegen_wrap_symbol_in_merged_module lto_codegen_compile_to_file LLVMCreateDisasm LLVMCreateDisasmCPU |