From e3585ff7af17acda65bbdac66530bbf5f67fdbca Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 25 Aug 2020 09:36:51 +0200 Subject: [PATCH] [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 --- compiler-rt/test/asan/Unit/lit.site.cfg.py.in | 9 +++++++++ compiler-rt/test/asan/lit.cfg.py | 11 +++++++++++ 2 files changed, 20 insertions(+) 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