diff options
author | Clifford Wolf <clifford@clifford.at> | 2016-03-30 10:02:03 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2016-03-30 10:02:03 +0200 |
commit | a47f69536a1ac93657d334f57dac2a800ab34f3f (patch) | |
tree | e7f1f91aca2f6cdbac9cb07e043e8193b62d5b3c /passes | |
parent | d4472ae9453c3eb713e2260b198d0236632a60b7 (diff) | |
download | yosys-a47f69536a1ac93657d334f57dac2a800ab34f3f.tar.gz yosys-a47f69536a1ac93657d334f57dac2a800ab34f3f.tar.bz2 yosys-a47f69536a1ac93657d334f57dac2a800ab34f3f.zip |
Added support for installed plugins
Diffstat (limited to 'passes')
-rw-r--r-- | passes/cmds/plugin.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/passes/cmds/plugin.cc b/passes/cmds/plugin.cc index e2d80d9bf..828c671de 100644 --- a/passes/cmds/plugin.cc +++ b/passes/cmds/plugin.cc @@ -31,19 +31,23 @@ std::map<std::string, std::string> loaded_plugin_aliases; #ifdef YOSYS_ENABLE_PLUGINS void load_plugin(std::string filename, std::vector<std::string> aliases) { + std::string orig_filename = filename; + if (filename.find('/') == std::string::npos) filename = "./" + filename; if (!loaded_plugins.count(filename)) { void *hdl = dlopen(filename.c_str(), RTLD_LAZY|RTLD_LOCAL); + if (hdl == NULL && orig_filename.find('/') == std::string::npos) + hdl = dlopen((proc_share_dirname() + "plugins/" + orig_filename + ".so").c_str(), RTLD_LAZY|RTLD_LOCAL); if (hdl == NULL) log_cmd_error("Can't load module `%s': %s\n", filename.c_str(), dlerror()); - loaded_plugins[filename] = hdl; + loaded_plugins[orig_filename] = hdl; Pass::init_register(); } for (auto &alias : aliases) - loaded_plugin_aliases[alias] = filename; + loaded_plugin_aliases[alias] = orig_filename; } #else void load_plugin(std::string, std::vector<std::string>) |