<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 - ld -export-dynamic -r should probably ignore the -export-dynamic"
   href="https://bugs.llvm.org/show_bug.cgi?id=43552">43552</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ld  -export-dynamic -r should probably ignore the   -export-dynamic
          </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>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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rafael@espindo.la
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The dpdk build system gets its flags confused and passes -export-dynamic to "ld
-r".

It looks like bfd ignores -export-dynamic when used with -r, but lld doesn't.
The output produced by lld is relocatable, but has a .dynsym.

If that file is then passed to lld, it gets confused and produces a program
that crashes at startup.

$ cat test.s
.globl _start
_start:
          mov $60, %rax
          mov $0, %rdi
          syscall

$ clang -c test.s
$ ld.lld -export-dynamic -r -o lld.o test.o
$ ld.lld -dynamic-linker /lib64/ld-linux-x86-64.so.2 /lib64/libgcc_s.so.1 lld.o
-o test.lld
$ ./test.lld
./run.sh: line 10: 106569 Segmentation fault      (core dumped) ./test.lld</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>