Skip to content

Commit 77b2ad3

Browse files
committed
[lldb][test] Skip libc++ tests if it is linked statically.
Some tests from 'import-std-module' used to fail on the builder https://lab.llvm.org/staging/#/builders/195/builds/4470, since libcxx is set up to be linked statically with the binary on it. Thus, they were temporarily disabled in llvm#112530. Here, this commit is reverted. When libcxx is linked with a program as an archive of static libraries, functions that aren't used in the program are omitted. Then, jitted expressions from the tests try calling several functions that aren't present in the process image, which causes the failure. LLD (and GNU ld AFAIK) links a binary with libcxx shared library if libc++.so is present in corresponding library search paths. Otherwise, it tries static linking. Here, a linker flag is added to a clang call in libcxx configuration, that ensures that libc++.so is present and found by linker. Forcing linker to keep all functions from libcxx archive in this way llvm#98701, without checking whether libcxx is linked statically looks like a less clean solution, but I'm not sure about that.
1 parent 9186c68 commit 77b2ad3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ def canRunLibcxxTests():
776776

777777
if platform == "linux":
778778
with tempfile.NamedTemporaryFile() as f:
779-
cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"]
779+
cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-l:libc++.so", "-o", f.name, "-"]
780780
p = subprocess.Popen(
781781
cmd,
782782
stdin=subprocess.PIPE,

0 commit comments

Comments
 (0)