Skip to content

Commit

Permalink
Revert "circt: Drop dylib patch, just working around for now."
Browse files Browse the repository at this point in the history
This reverts commit 9737aba.
  • Loading branch information
dtzSiFive committed Aug 16, 2024
1 parent b240fc7 commit e0f646a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions circt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ in stdenv.mkDerivation {
./patches/circt-mlir-tblgen-path.patch
./patches/circt-mlir-cpu-runner-target.patch
./patches/circt-install-dir.patch
./patches/circt-lit-dylib-paths.patch
];
postPatch = ''
substituteInPlace cmake/modules/GenVersionFile.cmake \
Expand Down
49 changes: 49 additions & 0 deletions patches/circt-lit-dylib-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From be96ffaae1e9cdbc53151ba1797bf6dc111c5dae Mon Sep 17 00:00:00 2001
From: Will Dietz <will.dietz@sifive.com>
Date: Fri, 10 May 2024 12:43:46 -0500
Subject: [PATCH] dylib-lit-paths

lit.cfg.py only, leave Unit as-is for now.
---
test/lit.cfg.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/test/lit.cfg.py b/test/lit.cfg.py
index 009a561a5..abbf72a60 100644
--- a/test/lit.cfg.py
+++ b/test/lit.cfg.py
@@ -90,3 +90,31 @@ if config.slang_frontend_enabled:
tools.append('circt-verilog')

llvm_config.add_tool_substitutions(tools, tool_dirs)
+
+
+def find_shlibpath_var():
+ if platform.system() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "SunOS"]:
+ yield "LD_LIBRARY_PATH"
+ elif platform.system() == "Darwin":
+ yield "DYLD_LIBRARY_PATH"
+ elif platform.system() == "Windows":
+ yield "PATH"
+ elif platform.system() == "AIX":
+ yield "LIBPATH"
+
+
+for shlibpath_var in find_shlibpath_var():
+ # in stand-alone builds, shlibdir is clang's build tree
+ # while llvm_libs_dir is installed LLVM (and possibly older clang)
+ shlibpath = os.path.pathsep.join(
+ (
+ config.circt_shlib_dir,
+ config.environment.get(shlibpath_var, ""),
+ )
+ )
+ config.environment[shlibpath_var] = shlibpath
+ break
+else:
+ lit_config.warning(
+ "unable to inject shared library path on '{}'".format(platform.system())
+ )
--
2.39.3 (Apple Git-146)

0 comments on commit e0f646a

Please sign in to comment.