<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 - lld-linked dylib causes crash related to TLV and weak visibility"
   href="https://bugs.llvm.org/show_bug.cgi?id=50769">50769</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld-linked dylib causes crash related to TLV and weak visibility
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>MachO
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>gkm@fb.com, jezreel@gmail.com, llvm-bugs@lists.llvm.org, smeenai@fb.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>repro:
<a href="https://drive.google.com/file/d/1ltewPgQCgRrznXHPnLiLx8lsYk8CfdRC/view?usp=sharing">https://drive.google.com/file/d/1ltewPgQCgRrznXHPnLiLx8lsYk8CfdRC/view?usp=sharing</a>

The repro file links libabsl.dylib , the other binaries are prebuilt.


 % ld @response.txt
 % ./gl_unittests --gtest_filter=GLSurfaceEGLTest.SurfaceFormatTest
--single-process-tests

=> passes


Same with ld64.lld crashes:

 % ./gl_unittests --gtest_filter=GLSurfaceEGLTest.SurfaceFormatTest
--single-process-tests
[94027:775:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[94027:775:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data
received.
Note: Google Test filter = GLSurfaceEGLTest.SurfaceFormatTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from GLSurfaceEGLTest
[ RUN      ] GLSurfaceEGLTest.SurfaceFormatTest
Received signal 11 <unknown> 000000000000
0   libbase.dylib                       0x00000001060af32f
base::debug::CollectStackTrace(void**, unsigned long) + 31
1   libbase.dylib                       0x0000000105d9e0d8
base::debug::StackTrace::StackTrace(unsigned long) + 72
2   libbase.dylib                       0x0000000105d9e15d
base::debug::StackTrace::StackTrace(unsigned long) + 29
3   libbase.dylib                       0x0000000105d9e135
base::debug::StackTrace::StackTrace() + 37
4   libbase.dylib                       0x00000001060af1d3
base::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*,
void*) + 1331
5   libsystem_platform.dylib            0x00007fff728d25fd _sigtramp + 29
6   ???                                 0x0000000000000000 0x0 + 0
7   libabsl.dylib                       0x0000000108340936
absl::container_internal::ShouldInsertBackwards(unsigned long, signed char*) +
38
8   libGLESv2.dylib                     0x000000011dacdc2b
absl::container_internal::find_first_non_full(signed char*, unsigned long,
unsigned long) + 219



That code is this thread_local:
<a href="https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc;l=31?q=raw_hash_set.cc">https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc;l=31?q=raw_hash_set.cc</a>
(We go down the  ABSL_HAVE_THREAD_LOCAL branch)

libabsl.dylib is built with default visibility. All the other binaries were
built with -fvisibility=hidden. If we build the absl code with
-fvisibility-inlines-hidden, the crash goes away.



Downstrem bug: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=1220100">https://bugs.chromium.org/p/chromium/issues/detail?id=1220100</a></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>