Skip to content

Commit 2cbf28d

Browse files
committed
[test] Set LD_LIBRARY_PATH if testing on OpenBSD.
LLVM binaries are built with rpath and dynamic libraries referenced relative to $ORIGIN. However, on OpenBSD, ld.so resolves $ORIGIN relative to the working directory, because on this platform there is no mechanism available to generically and portably track the path of a running executable[1]. Therefore, work around this by setting LD_LIBRARY_PATH to ensure that LLVM executables running in unit tests can properly reference the necessary LLVM dynamic libraries. [1] See https://marc.info/?l=openbsd-misc&m=144987773230417&w=2
1 parent 754f21d commit 2cbf28d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/lit.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ swift_obj_root = getattr(config, 'swift_obj_root', None)
166166
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
167167
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
168168

169+
if platform.system() == 'OpenBSD':
170+
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
171+
if not llvm_libs_dir:
172+
lit_config.fatal('No LLVM libs dir set.')
173+
config.environment['LD_LIBRARY_PATH'] = llvm_libs_dir
174+
169175
def append_to_env_path(directory):
170176
config.environment['PATH'] = \
171177
os.path.pathsep.join((directory, config.environment['PATH']))

0 commit comments

Comments
 (0)