<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 error message for undefined symbol lacks information about visibility"
   href="https://bugs.llvm.org/show_bug.cgi?id=40770">40770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld error message for undefined symbol lacks information about visibility
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mh+llvm@glandium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>```
$ cat foo.c
__attribute__((visibility("hidden"))) void* getdate(char*);

void* foo(char* s) {
    return getdate(s);
}
$ clang -fuse-ld=lld -shared -fPIC foo.c -o foo.so 
ld.lld: error: undefined symbol: getdate
<span class="quote">>>> referenced by foo.c
>>>               /tmp/foo-717a38.o:(foo)</span >
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

GNU ld.bfd and gold both report the fact the symbol is hidden in their error
message:
```
$ clang-7 -fuse-ld=ld -shared -fPIC foo.c -o foo.so 
/usr/bin/ld: /tmp/foo-8f3391.o: in function `foo':
foo.c:(.text+0x11): undefined reference to `getdate'
/usr/bin/ld: foo.so: hidden symbol `getdate' isn't defined
/usr/bin/ld: final link failed: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ LANG=C clang-7 -fuse-ld=gold -shared -fPIC foo.c -o foo.so 
/usr/bin/ld.gold: error: hidden symbol 'getdate' is not defined locally
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```</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>