<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56939>56939</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Provide workaround for invalid LC_LINKER_OPTIONs
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld:MachO
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          keith
      </td>
    </tr>
</table>

<pre>
    ld64 has a somewhat surprising feature where it ignores invalid frameworks / libraries included by `LC_LINKER_OPTION`s: https://github.com/keith/ld64/blob/eddf3fd275669887e70392a1f7d8355222fa295e/src/ld/InputFiles.cpp#L716-L717 unless the entire link fails, in which case it prints warnings about them.

Unfortunately this case exists in the wild because this logic hides these issues, then with lld it fails to link. Ideally users would fix the cases they encounter, but that can be difficult when they don't control the problematic code.

I'm not sure if we should implement the exact version of this that ld64 does, but I think we should at least implement some workaround, as this is a hard blocker for folks to even test lld when they hit it. We could potentially add a flag such as `--ignore-autolinked-framework Foo` for this case.

Also worth noting ld64 has a related flag `-ignore_auto_link` (which lld doesn't currently implement) which ignores _all_ autolink directives. The practical problem with this is that if the code being linked includes Swift you'd have to manually specify some internal libraries like SwiftONoneSupport, which is probably a bit too much work for most folks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9VE1v4zYQ_TXyhbBh68vWQYd0twGMpsmiu4seDYocWaxpUiApO_73faTiJNtDAVsyTc7Mm_fesLPy1mpZl2zgnnHm7ZmuAw_MT250yitzZD3xMDli14HwVIGpo7GOPFPmwrWSrHccUdadPMvyR6ZV57hT6YDQkyTJuhvL6vXTl8PT_vmP3_86vHz7sX95xl8-Kx7YEMIYfyAYn6MKw9SthD1jcSKs8I4Q8eq07fAiKfuil_m2qutmt9vSdl00Od_0W7krqirP857nTUU46p1I4XjszTiFR6XJr8Q4ZnnxtN3USzy2bDL417MwECMTFNrUypxYz5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