[llvm-bugs] [Bug 52158] New: Asan-i386-*-Dynamic-Test fails with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 12 13:02:11 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52158

            Bug ID: 52158
           Summary: Asan-i386-*-Dynamic-Test fails with
                    LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: collinbaker at chromium.org
                CC: llvm-bugs at lists.llvm.org

Asan-i386-calls-Dynamic-Test and Asan-i386-inline-Dynamic-Test tests fail to
run due to a dynamic linking issue:

<redacted>/llvm-project/build-vanilla/projects/compiler-rt/lib/asan/tests/dynamic/./Asan-i386-calls-Dynamic-Test:
error while loading shared libraries: libclang_rt.asan.so: wrong ELF class:
ELFCLASS64

With printf debugging around
https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/llvm/utils/lit/lit/util.py#L338
to display LD_LIBRARY_PATH, the test outputs 

FAIL: AddressSanitizer-Unit ::
./Asan-i386-calls-Dynamic-Test/failed_to_discover_tests_from_gtest (1299 of
86439)
******************** TEST 'AddressSanitizer-Unit ::
./Asan-i386-calls-Dynamic-Test/failed_to_discover_tests_from_gtest' FAILED
********************
Script:
--
/usr/local/google/home/collinbaker/llvm-project/build-vanilla/projects/compiler-rt/lib/asan/tests/dynamic/./Asan-i386-calls-Dynamic-Test
--gtest_filter=failed_to_discover_tests_from_gtest
--
/usr/local/google/home/collinbaker/llvm-project/build-vanilla/projects/compiler-rt/lib/asan/tests/dynamic/./Asan-i386-calls-Dynamic-Test:
error while loading shared libraries: libclang_rt.asan.so: wrong ELF class:
ELFCLASS64

LD_LIBRARY_PATH =
/usr/local/google/home/collinbaker/llvm-project/build-vanilla/./lib/clang/14.0.0/lib/x86_64-unknown-linux-gnu:


This indicates LD_LIBRARY_PATH is not set correctly when
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON.

The LD_LIBRARY_PATH for these tests is set here:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/asan/Unit/lit.site.cfg.py.in#L44

That value comes from here:
https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/test/lit.common.configured.in#L29

Then from here:
https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/AddCompilerRT.cmake#L710

And finally from here:
https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L504

Since the default arch is always used, rather than the arch for the specific
binary, the dynamic linking path always resolves to the x86_64 runtime on my
machine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211012/b1d68233/attachment.html>


More information about the llvm-bugs mailing list