<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 - LTO ignores linker script symbol visibility"
   href="https://bugs.llvm.org/show_bug.cgi?id=45391">45391</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LTO ignores linker script symbol 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>ELF
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Flutter is using the following linker script:

```
{
  global:
    JNI_OnLoad;
    _binary_icudtl_dat_start;
    _binary_icudtl_dat_size;
  local:
    *;
};
```

The intention is to avoid exposing any symbols except for the ones that are
explicitly listed. However, when enabling LTO, we see the following:

```
$ nm -gU out/android_release_arm64/libflutter.so 
0000000000299204 T JNI_OnLoad
00000000000aba10 R __clz_tab
0000000000290720 T __emutls_get_address
0000000000290878 T __emutls_register_common
00000000002908b4 T __udivti3
00000000000dc2b0 A _binary_icudtl_dat_size
000000000073cf00 D _binary_icudtl_dat_start
```

This issue only appeared after trying to update from LLVM 8 to 11 so it looks a
regression.

The reproducer is available at
<a href="https://storage.googleapis.com/fuchsia-build/lto-symbol-visibility-bug.tar.lzma">https://storage.googleapis.com/fuchsia-build/lto-symbol-visibility-bug.tar.lzma</a>
(note that the reproducer is 112M compressed due to the use of LTO).</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>