<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 inserts global symbols into dynamic symbol table for executable"
   href="https://bugs.llvm.org/show_bug.cgi?id=34057">34057</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD inserts global symbols into dynamic symbol table for executable
          </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>smeenai@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>compnerd@compnerd.org, grimar@accesssoftek.com, llvm-bugs@lists.llvm.org, rafael.espindola@gmail.com, ruiu@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>% cat f.c
void f() {}
void g() {}

% cat f.list
{ f; }

% cat f.script
{ global: f; g; };

% clang -c f.c
% ld.bfd --dynamic-list f.list --version-script f.script -o f f.o
/lib64/libc.so
% nm -D f
0000000000400230 T f

% ld.lld --dynamic-list f.list --version-script f.script -o f f.o
% nm -D f
0000000000201000 T f
0000000000201010 T g

(the /lib64/libc.so link for ld.bfd is needed because BFD and gold require an
executable to link against at least one so to get a dynamic symbol table,
whereas lld doesn't; the so being linked against isn't important. LLD doesn't
require this, which is another behavior difference; I don't know if that's
worth changing.)

BFD (and gold) only place symbols in the dynamic list in the dynamic symbol
table; LLD places any symbol marked as global in the dynamic symbol table. This
appears to be a consequence of LLD conflating the handling for dynamic lists
and version scripts (PR34053 is another consequence); it also complains about
having a duplicate symbol 'f' in version script, which doesn't seem right
either.</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>