• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Testing configuration for Apple's system libc++abi.
2#
3# This configuration differs from a normal LLVM shared library configuration in
4# that we must use DYLD_LIBRARY_PATH to run the tests against the just-built library,
5# since Apple's libc++abi has an absolute install_name.
6#
7# Finally, we also link against an artificial shims library that provides
8# the functionality necessary for the upstream libc++abi to be usable in place
9# of a system-provided libc++abi. Without that, attempting to replace the system
10# libc++abi with DYLD_LIBRARY_PATH would result in missing symbols and other similar
11# issues since the upstream libc++abi does not contain all the symbols provided by
12# the system library.
13
14lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
15
16import os, site
17site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
18import libcxx.test.params, libcxx.test.config, libcxx.test.dsl
19ADDITIONAL_PARAMETERS = [
20    libcxx.test.dsl.Parameter(name='apple_system_shims', type=str,
21        actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{apple-system-shims}', path)],
22        help="""
23        Path to a pre-built object file or static archive that contains shims necessary to
24        allow replacing the system libc++abi by the just-built one.
25        """),
26]
27
28config.substitutions.append(('%{flags}',
29    '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
30))
31config.substitutions.append(('%{compile_flags}',
32    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
33    '-I %{libcxx}/test/support -I %{libcxx}/src'
34))
35config.substitutions.append(('%{link_flags}',
36    '-nostdlib++ -L %{lib} -lc++ %{apple-system-shims}'
37))
38config.substitutions.append(('%{exec}',
39    '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib} -- '
40))
41
42config.stdlib = 'apple-libc++'
43
44libcxx.test.config.configure(
45    libcxx.test.params.DEFAULT_PARAMETERS + ADDITIONAL_PARAMETERS,
46    libcxx.test.features.DEFAULT_FEATURES,
47    config,
48    lit_config
49)
50