diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-06-14 20:29:47 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-06-14 20:29:47 +0000 |
commit | 182434afeeee6e33968b12124c916ca54b5a43f6 (patch) | |
tree | 3a769fce7123dcbf90e3e0e893add885795a6ddf /test | |
parent | 8443df81847c2cb5096a137b3780c4d99ccb09a5 (diff) |
[NFC] Generalize flags for linking in shared objects in compiler-rt tests to support using multiple shared objects at once
Differential Revision: https://reviews.llvm.org/D48156
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/lit.common.cfg | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/test/lit.common.cfg b/test/lit.common.cfg index 177e6ca4d..5c01df6d9 100644 --- a/test/lit.common.cfg +++ b/test/lit.common.cfg @@ -308,19 +308,28 @@ if config.host_os == 'Darwin' and config.ios and not config.iossim: lit_config.warning("iOS device test cases being run sequentially") lit_config.parallelism_groups["darwin-ios-device-sanitizer"] = 1 - -if config.host_os == 'Darwin': - config.substitutions.append( ("%ld_flags_rpath_exe", '-Wl,-rpath,@executable_path/ %dynamiclib') ) - config.substitutions.append( ("%ld_flags_rpath_so", '-install_name @rpath/`basename %dynamiclib`') ) -elif config.host_os == 'FreeBSD' or config.host_os == 'NetBSD': - config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") ) - config.substitutions.append( ("%ld_flags_rpath_so", '') ) -elif config.host_os == 'Linux': - config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") ) - config.substitutions.append( ("%ld_flags_rpath_so", '') ) -elif config.host_os == 'SunOS': - config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec") ) - config.substitutions.append( ("%ld_flags_rpath_so", '') ) +# Multiple substitutions are necessary to support multiple shared objects used +# at once. +# Note that substitutions with numbers have to be defined first to avoid +# being subsumed by substitutions with smaller postfix. +for postfix in ["2", "1", ""]: + if config.host_os == 'Darwin': + config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, '-Wl,-rpath,@executable_path/ %dynamiclib' + postfix) ) + config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '-install_name @rpath/`basename %dynamiclib{}`'.format(postfix)) ) + elif config.host_os == 'FreeBSD' or config.host_os == 'NetBSD': + config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) ) + config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') ) + elif config.host_os == 'Linux': + config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) ) + config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') ) + elif config.host_os == 'SunOS': + config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) ) + config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') ) + + # Must be defined after the substitutions that use %dynamiclib. + config.substitutions.append( ("%dynamiclib" + postfix, '%T/%xdynamiclib_filename' + postfix) ) + config.substitutions.append( ("%xdynamiclib_filename" + postfix, 'lib%xdynamiclib_namespec{}.so'.format(postfix)) ) + config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') ) # Provide a substituion that can be used to tell Clang to use a static libstdc++. # The substitution expands to nothing on non Linux platforms. @@ -330,11 +339,6 @@ if config.host_os == 'Linux': else: config.substitutions.append( ("%linux_static_libstdcplusplus", "") ) -# Must be defined after the substitutions that use %dynamiclib. -config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') ) -config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') ) -config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') ) - config.default_sanitizer_opts = [] if config.host_os == 'Darwin': # On Darwin, we default to `abort_on_error=1`, which would make tests run |