<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 - Implement filter library support (-F / --filter)"
   href="https://bugs.llvm.org/show_bug.cgi?id=33766">33766</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Implement filter library support (-F / --filter)
          </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>FreeBSD
          </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>emaste@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>23214
          </td>
        </tr></table>
      <p>
        <div>
        <pre>FreeBSD recently added a dummy libdl as a filter library
(<a href="https://reviews.freebsd.org/rS320872">https://reviews.freebsd.org/rS320872</a>) to ease porting of software from Linux,
which expects -ldl to work, and we'd like to support -F/--filter with lld (and
presumably -f/--auxiliary also).

Filter library details are here:
<a href="https://docs.oracle.com/cd/E19683-01/817-3677/chapter4-31738/index.html">https://docs.oracle.com/cd/E19683-01/817-3677/chapter4-31738/index.html</a>

Using the FreeBSD change as an example, to produce a filter library we add
`-F,libc.so.7`. The primary effect is that the resulting shared object gains a
DT_FILTER entry:

Dynamic section at offset 0xd30 contains 25 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.7]
 0x000000000000000e (SONAME)             Library soname: [libdl.so.1]
 0x000000007fffffff (FILTER)             Filter library: [libc.so.7]

When the runtime loader encounters this it uses the named filtee library
(libc.so.7) to resolve symbols from the filter library.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [META] Using LLD as FreeBSD's system linker"
   href="https://bugs.llvm.org/show_bug.cgi?id=23214">Bug 23214</a>] [META] Using LLD as FreeBSD's system linker
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>