CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
CHECK: linking foo.exe-foobar.o -> foo.exe
-CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
-CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
+CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 {{(-L.*)? (-Wl,-rpath,.*)?}} -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
+CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 {{(-L.*)? (-Wl,-rpath,.*)?}} -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
if config.dotest_lit_args_str:
dotest_cmd.extend(shlex.split(config.dotest_lit_args_str))
+# Library path may be needed to locate just-built clang.
+if config.llvm_libs_dir:
+ dotest_cmd += ['--env', 'LLVM_LIBS_DIR=' + config.llvm_libs_dir]
+
# Load LLDB test format.
sys.path.append(os.path.join(config.lldb_src_root, "lit", "Suite"))
import lldbtest
required=True,
help='Path to a compiler executable, or one of the values [any, msvc, clang-cl, gcc, clang]')
+parser.add_argument('--libs-dir',
+ metavar='directory',
+ dest='libs_dir',
+ required=False,
+ action='append',
+ help='If specified, a path to linked libraries to be passed via -L')
+
parser.add_argument('--tools-dir',
metavar='directory',
dest='tools_dir',
self.nodefaultlib = args.nodefaultlib
self.verbose = args.verbose
self.obj_ext = obj_ext
+ self.lib_paths = args.libs_dir
def _exe_file_name(self):
assert self.mode != 'compile'
if sys.platform == 'darwin':
main_symbol = '_main'
args.append('-Wl,-e,' + main_symbol)
+ if sys.platform.startswith('netbsd'):
+ for x in self.lib_paths:
+ args += ['-L' + x, '-Wl,-rpath,' + x]
args.extend(['-o', self._exe_file_name()])
args.extend(self._obj_file_names())
build_script_args.append('--tools-dir={0}'.format(config.lldb_lit_tools_dir))
if config.lldb_tools_dir:
build_script_args.append('--tools-dir={0}'.format(config.lldb_tools_dir))
+ if config.llvm_libs_dir:
+ build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
primary_tools = [
ToolSubst('%lldb',
elif platform.system() in ['NetBSD', 'OpenBSD', 'Linux']:
flags = ['-pthread']
+ if sys.platform.startswith('netbsd'):
+ # needed e.g. to use freshly built libc++
+ flags += ['-L' + config.llvm_libs_dir,
+ '-Wl,-rpath,' + config.llvm_libs_dir]
additional_tool_dirs=[]
if config.lldb_lit_tools_dir:
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
+ifneq (,$(LLVM_LIBS_DIR))
+ ifeq ($(OS),NetBSD)
+ LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR)
+ endif
+endif
ifeq (,$(filter $(OS), Windows_NT Android Darwin))
ifneq (,$(filter YES,$(ENABLE_THREADS)))
LDFLAGS += -pthread