Index: compiler-rt/trunk/test/lit.common.cfg =================================================================== --- compiler-rt/trunk/test/lit.common.cfg +++ compiler-rt/trunk/test/lit.common.cfg @@ -308,19 +308,28 @@ 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 @@ 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