[PATCH] D86333: [compiler-rt][asan][test] Set LD_LIBRARY_PATH_{32, 64} on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 00:48:46 PDT 2020


ro created this revision.
ro added reviewers: vitalybuka, arichardson.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, fedor.sergeev, dberris.
ro requested review of this revision.

The dynamically linked ASan tests rely on `LD_LIBRARY_PATH` to find `libclang_rt.asan-*.so` at runtime.

However, the Solaris runtime linker `ld.so.1` also supports more specific variables: `LD_LIBRARY_PATH_32` and `LD_LIBRARY_PATH_64` respectively.  If those happen to be set, `LD_LIBRARY_PATH` is ignored.  In such a case, all dynamically linked ASan tests `FAIL`.  For i386 alone, this affects about 200 tests.

The following patch fixes that by also setting `LD_LIBRARY_PATH_{32,64}` on Solaris.

Tested on `amd64-pc-solaris2.11` both with only `LD_LIBRARY_PATH` set and with `LD_LIBRARY_PATH_{32,64}` set too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86333

Files:
  compiler-rt/test/asan/Unit/lit.site.cfg.py.in
  compiler-rt/test/asan/lit.cfg.py


Index: compiler-rt/test/asan/lit.cfg.py
===================================================================
--- compiler-rt/test/asan/lit.cfg.py
+++ compiler-rt/test/asan/lit.cfg.py
@@ -42,6 +42,17 @@
       (new_path, config.environment.get(dynamic_library_lookup_var, '')))
     config.environment[dynamic_library_lookup_var] = new_ld_32_library_path
 
+  if platform.system() == 'SunOS':
+    dynamic_library_lookup_var = 'LD_LIBRARY_PATH_32'
+    new_ld_library_path_32 = os.path.pathsep.join(
+      (new_path, config.environment.get(dynamic_library_lookup_var, '')))
+    config.environment[dynamic_library_lookup_var] = new_ld_library_path_32
+
+    dynamic_library_lookup_var = 'LD_LIBRARY_PATH_64'
+    new_ld_library_path_64 = os.path.pathsep.join(
+      (new_path, config.environment.get(dynamic_library_lookup_var, '')))
+    config.environment[dynamic_library_lookup_var] = new_ld_library_path_64
+
 # Setup config name.
 config.name = 'AddressSanitizer' + config.name_suffix
 
Index: compiler-rt/test/asan/Unit/lit.site.cfg.py.in
===================================================================
--- compiler-rt/test/asan/Unit/lit.site.cfg.py.in
+++ compiler-rt/test/asan/Unit/lit.site.cfg.py.in
@@ -16,6 +16,15 @@
       (new_path, config.environment.get('LD_32_LIBRARY_PATH', '')))
     config.environment['LD_32_LIBRARY_PATH'] = new_ld_32_library_path
 
+  if platform.system() == 'SunOS':
+    new_ld_library_path_32 = os.path.pathsep.join(
+      (new_path, config.environment.get('LD_LIBRARY_PATH_32', '')))
+    config.environment['LD_32_LIBRARY_PATH'] = new_ld_library_path_32
+
+    new_ld_library_path_64 = os.path.pathsep.join(
+      (new_path, config.environment.get('LD_LIBRARY_PATH_64', '')))
+    config.environment['LD_64_LIBRARY_PATH'] = new_ld_library_path_64
+
 # Setup config name.
 config.name = 'AddressSanitizer-Unit'
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86333.286903.patch
Type: text/x-patch
Size: 1861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/4b199d82/attachment.bin>


More information about the llvm-commits mailing list