diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-22 13:58:36 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-22 14:00:11 +0200 |
commit | a3494fa9ed32d7ff2b826dfc921e3a0139158880 (patch) | |
tree | 98793a987d65abe7c663fc5f82f4f5b6a9cae161 /kernel/driver.cc | |
parent | 752650a062cb262b37f1c5ea62663e5c8c9c7928 (diff) | |
download | yosys-a3494fa9ed32d7ff2b826dfc921e3a0139158880.tar.gz yosys-a3494fa9ed32d7ff2b826dfc921e3a0139158880.tar.bz2 yosys-a3494fa9ed32d7ff2b826dfc921e3a0139158880.zip |
Added "plugin" command
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r-- | kernel/driver.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index d59e68a50..6bd60d7b5 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -27,7 +27,6 @@ #include <string.h> #include <unistd.h> #include <libgen.h> -#include <dlfcn.h> #include <limits.h> #include <errno.h> @@ -38,7 +37,7 @@ int main(int argc, char **argv) std::string frontend_command = "auto"; std::string backend_command = "auto"; std::vector<std::string> passes_commands; - std::vector<void*> loaded_modules; + std::vector<std::string> plugin_filenames; std::string output_filename = ""; std::string scriptfile = ""; bool scriptfile_tcl = false; @@ -82,11 +81,7 @@ int main(int argc, char **argv) passes_commands.push_back("opt"); break; case 'm': - loaded_modules.push_back(dlopen(optarg, RTLD_LAZY|RTLD_GLOBAL)); - if (loaded_modules.back() == NULL) { - fprintf(stderr, "Can't load module `%s': %s\n", optarg, dlerror()); - exit(1); - } + plugin_filenames.push_back(optarg); break; case 'f': frontend_command = optarg; @@ -239,6 +234,9 @@ int main(int argc, char **argv) yosys_setup(); + for (auto &fn : plugin_filenames) + load_plugin(fn, {}); + if (optind == argc && passes_commands.size() == 0 && scriptfile.empty()) { if (!got_output_filename) backend_command = ""; @@ -346,9 +344,6 @@ int main(int argc, char **argv) yosys_shutdown(); - for (auto mod : loaded_modules) - dlclose(mod); - return 0; } |