<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - linker driver should not use -export_dynamic when the linker does not support it"
   href="https://llvm.org/bugs/show_bug.cgi?id=31465">31465</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>linker driver should not use -export_dynamic when the linker does not support it
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jeremyhu@apple.com
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Reported in <a href="https://trac.macports.org/ticket/53150">https://trac.macports.org/ticket/53150</a>

If -rdynamic is passed to clang, it will unconditionally pass -export_dynamic
to ld, causing an error in versions that don't support it.

It looks like this was expected to be fixed by r187680, but it seems to be a
problem on all versions I've still got around (3.3 through current trunk):


commit bd77c59acc58e797756b0fcc6739319587e95d85
Author: Bob Wilson <<a href="mailto:bob.wilson@apple.com">bob.wilson@apple.com</a>>
Date:   Fri Aug 2 22:25:34 2013 +0000

    Only use the Darwin linker's -export_dynamic option with supported
versions.

    Related to <rdar://problem/14578094>.

    git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@187680">https://llvm.org/svn/llvm-project/cfe/trunk@187680</a>
91177308-0d34-0410-b5e6-96231b3b80d8

---


$ clang-mp-devel -c true.c && clang-mp-devel -rdynamic true.o -v
clang version 4.0.0 (trunk 290074)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-devel/bin
 "/opt/local/libexec/llvm-devel/bin/ld" -demangle -export_dynamic -lto_library
/opt/local/libexec/llvm-devel/lib/libLTO.dylib -dynamic -arch x86_64
-macosx_version_min 10.9.0 -o a.out true.o -lSystem
/opt/local/libexec/llvm-devel/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a
ld: unknown option: -export_dynamic
clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ /opt/local/libexec/llvm-devel/bin/ld -v
@(#)PROGRAM:ld  PROJECT:ld64-136
configured to support archs: i386 x86_64 armv7 armv7s
LTO support using: LLVM version 4.0.0svn</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>