diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2022-07-27 14:16:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 14:16:46 +0200 |
commit | 29a5947bf83c8011e62cc859a0a832ee8ab690ee (patch) | |
tree | 0a894b3a5c42fff225f703d472ef4edbce3d3f86 /kernel/driver.cc | |
parent | bc012995b44ca9a68524ae3a1ecb4b871d1436c9 (diff) | |
download | yosys-29a5947bf83c8011e62cc859a0a832ee8ab690ee.tar.gz yosys-29a5947bf83c8011e62cc859a0a832ee8ab690ee.tar.bz2 yosys-29a5947bf83c8011e62cc859a0a832ee8ab690ee.zip |
Make all compile under OpenBSD (#3423)
Co-authored-by: Josuah Demangeon <me@josuah.net>
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r-- | kernel/driver.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index f8f940e89..e52e1fb0e 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -192,6 +192,13 @@ void yosys_atexit() #endif } +#if defined(__OpenBSD__) +namespace Yosys { +extern char *yosys_argv0; +extern char yosys_path[PATH_MAX]; +}; +#endif + int main(int argc, char **argv) { std::string frontend_command = "auto"; @@ -498,6 +505,12 @@ int main(int argc, char **argv) if (print_stats) log_hasher = new SHA1; +#if defined(__OpenBSD__) + // save the executable origin for proc_self_dirname() + yosys_argv0 = argv[0]; + realpath(yosys_argv0, yosys_path); +#endif + #if defined(__linux__) // set stack size to >= 128 MB { |