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

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 00:37:25 PDT 2020


Author: Rainer Orth
Date: 2020-08-25T09:36:51+02:00
New Revision: e3585ff7af17acda65bbdac66530bbf5f67fdbca

URL: https://github.com/llvm/llvm-project/commit/e3585ff7af17acda65bbdac66530bbf5f67fdbca
DIFF: https://github.com/llvm/llvm-project/commit/e3585ff7af17acda65bbdac66530bbf5f67fdbca.diff

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

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.

Differential Revision: https://reviews.llvm.org/D86333

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
index d1fd640e7385..aae5078affad 100644
--- a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
@@ -16,6 +16,15 @@ def push_ld_library_path(config, new_path):
       (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'
 

diff  --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 63c02f7ddeeb..16a73d65b2b1 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -42,6 +42,17 @@ def push_dynamic_library_lookup_path(config, new_path):
       (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
 


        


More information about the llvm-commits mailing list