[llvm-bugs] [Bug 45391] New: LTO ignores linker script symbol visibility

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 1 14:28:32 PDT 2020


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

            Bug ID: 45391
           Summary: LTO ignores linker script symbol visibility
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: phosek at chromium.org
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

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

-- 
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/20200401/0e09d152/attachment-0001.html>


More information about the llvm-bugs mailing list