<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Asan-i386-*-Dynamic-Test fails with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on"
   href="https://bugs.llvm.org/show_bug.cgi?id=52158">52158</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Asan-i386-*-Dynamic-Test fails with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>collinbaker@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
<a href="https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/llvm/utils/lit/lit/util.py#L338">https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/llvm/utils/lit/lit/util.py#L338</a>
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:
<a href="https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/asan/Unit/lit.site.cfg.py.in#L44">https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/asan/Unit/lit.site.cfg.py.in#L44</a>

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

Then from here:
<a href="https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/AddCompilerRT.cmake#L710">https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/AddCompilerRT.cmake#L710</a>

And finally from here:
<a href="https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L504">https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L504</a>

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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>