[compiler-rt] r334765 - [NFC] Generalize flags for linking in shared objects in compiler-rt tests to support using multiple shared objects at once

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 13:29:47 PDT 2018


Author: george.karpenkov
Date: Thu Jun 14 13:29:47 2018
New Revision: 334765

URL: http://llvm.org/viewvc/llvm-project?rev=334765&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/test/lit.common.cfg

Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=334765&r1=334764&r2=334765&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Thu Jun 14 13:29:47 2018
@@ -308,19 +308,28 @@ if config.host_os == 'Darwin' and config
   lit_config.warning("iOS device test cases being run sequentially")
   lit_config.parallelism_groups["darwin-ios-device-sanitizer"] = 1
 
+# 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, at 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, '') )
 
-if config.host_os == 'Darwin':
-  config.substitutions.append( ("%ld_flags_rpath_exe", '-Wl,-rpath, at 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", '') )
+  # 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




More information about the llvm-commits mailing list