[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
This commit is contained in:
Rainer Orth 2020-08-25 09:36:51 +02:00
parent 879c1db5d2
commit e3585ff7af
2 changed files with 20 additions and 0 deletions

View File

@ -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'

View File

@ -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