From a3494fa9ed32d7ff2b826dfc921e3a0139158880 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 22 Aug 2014 13:58:36 +0200 Subject: Added "plugin" command --- kernel/driver.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'kernel/driver.cc') diff --git a/kernel/driver.cc b/kernel/driver.cc index d59e68a5..6bd60d7b 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,7 @@ int main(int argc, char **argv) std::string frontend_command = "auto"; std::string backend_command = "auto"; std::vector passes_commands; - std::vector loaded_modules; + std::vector 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; } -- cgit v1.2.3