llvm-project
014d5d51 - [lldb] Change most tests to build with system libc++ on Darwin (#190034)

Commit
16 days ago
[lldb] Change most tests to build with system libc++ on Darwin (#190034) Today, on Darwin platforms, almost every test binary in our test suite loads two copies of libc++, libc++abi, and libunwind. This is because each of the test binaries explicitly link against a just-built libc++ (which is explicitly required on Darwin right now) but we don't take the correct steps to replace the system libc++. Doing so is unnecessary and potentially error-prone, so most tests should link against the system libc++ where possible. Background: The lldb test suite has a collection of tests that rely on libc++ explicitly. The two biggest categories are data formatter tests (which make sure that we can correctly display values for std types) and import-std-module tests (which test that we can import the libc++ std module). To make sure these tests are run, we require a just-built libc++ to be used. All of the test binaries link against the just-built libc++, so it gets loaded. However, when any system library tries to load libc++, it attempts to load the system one. dyld checks loaded libraries against the request to load a new one using the full path, meaning anyone linking against `/usr/lib/libc++.1.dylib` will get it no matter what other libc++ dylib is already loaded. The proper way to handle this is using `DYLD_LIBRARY_PATH`, which switches dyld to checking the leaf name of a dylib instead of the full path. In theory this works, but we run into an issue where the system libc++ has additional symbols and many system libraries fail to load. Louis Dionne added stubs in libc++abi for these missing symbols, meaning it would be possible to make this scenario work. This may be useful for the existing libc++ tests.
Author
Parents
Loading