summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2019-03-06 14:03:18 +0000
committerMichal Gorny <mgorny@gentoo.org>2019-03-06 14:03:18 +0000
commita2cc148f9fee10ff749a101975a23703e5460d0b (patch)
treeb3dbee830d16a9ea4ef9dcb18871b8db4bf684e7 /lldb
parentf2eb8caa3fbb4338c061782d9b414fcadd8f9e40 (diff)
downloadbcm5719-llvm-a2cc148f9fee10ff749a101975a23703e5460d0b.tar.gz
bcm5719-llvm-a2cc148f9fee10ff749a101975a23703e5460d0b.zip
[lldb] [test] Pass appropriate -L&-Wl,-rpath for libc++ on NetBSD
Pass appropriate -L and -Wl,-rpath flags pointing out to the LLVM library directory on NetBSD. This is necessary since clang on NetBSD requires libc++ but it is not installed as part of the system by default. For the purpose of running buildbot, we want LLDB to use just-built libc++. Differential Revision: https://reviews.llvm.org/D58630 llvm-svn: 355502
Diffstat (limited to 'lldb')
-rw-r--r--lldb/lit/BuildScript/toolchain-clang.test4
-rw-r--r--lldb/lit/Suite/lit.cfg4
-rwxr-xr-xlldb/lit/helper/build.py11
-rw-r--r--lldb/lit/helper/toolchain.py6
-rw-r--r--lldb/packages/Python/lldbsuite/test/make/Makefile.rules5
5 files changed, 28 insertions, 2 deletions
diff --git a/lldb/lit/BuildScript/toolchain-clang.test b/lldb/lit/BuildScript/toolchain-clang.test
index 416dc30f6c9..ce5a56a2d9f 100644
--- a/lldb/lit/BuildScript/toolchain-clang.test
+++ b/lldb/lit/BuildScript/toolchain-clang.test
@@ -10,5 +10,5 @@ CHECK: compiling foobar.c -> foo.exe-foobar.o
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
diff --git a/lldb/lit/Suite/lit.cfg b/lldb/lit/Suite/lit.cfg
index 790d6d11c0a..0c270f5e690 100644
--- a/lldb/lit/Suite/lit.cfg
+++ b/lldb/lit/Suite/lit.cfg
@@ -65,6 +65,10 @@ dotest_cmd.extend(config.dotest_args_str.split(';'))
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
diff --git a/lldb/lit/helper/build.py b/lldb/lit/helper/build.py
index 1b8227d163c..d82c688de7b 100755
--- a/lldb/lit/helper/build.py
+++ b/lldb/lit/helper/build.py
@@ -35,6 +35,13 @@ parser.add_argument('--compiler',
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',
@@ -225,6 +232,7 @@ class Builder(object):
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'
@@ -650,6 +658,9 @@ class GccBuilder(Builder):
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())
diff --git a/lldb/lit/helper/toolchain.py b/lldb/lit/helper/toolchain.py
index 9d851ceb2db..75812c3e58a 100644
--- a/lldb/lit/helper/toolchain.py
+++ b/lldb/lit/helper/toolchain.py
@@ -31,6 +31,8 @@ def use_lldb_substitutions(config):
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',
@@ -99,6 +101,10 @@ def use_support_substitutions(config):
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:
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 378f5af3c5f..bee67ed0341 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -297,6 +297,11 @@ CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
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
OpenPOWER on IntegriCloud