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

    <tr>
        <th>Summary</th>
        <td>
            [lld] crash linking OSS https://github.com/Ranchero-Software/NetNewsWire
        </td>
    </tr>

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

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

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

<pre>
    Hi,

I'm seeing a crash linking this Open Source project https://github.com/Ranchero-Software/NetNewsWire during linking. The crash occurs here in `lld/MachO/SyntheticSections.cpp` building of main. `*reloc` is returned nil inside the loop. I'm working with the source at the moment, if you have any suggestions I could try or information I can gather let me know as I'd like to see if I can fix this.
```
void ObjCMethListSection::setUp() {
  for (const ConcatInputSection *isec : inputs) {
    uint32_t structSizeAndFlags = 0, structCount = 0;
 readMethodListHeader(isec->data.data(), structSizeAndFlags, structCount);
 uint32_t originalStructSize = structSizeAndFlags & structSizeMask;
    // Method name is immediately after header
    uint32_t methodNameOff = methodListHeaderSize;

    // Loop through all methods, and ensure a selref for each of them exists.
    while (methodNameOff < isec->data.size()) {
 const Reloc *reloc = isec->getRelocAt(methodNameOff);
      assert(reloc && "Relocation expected at method list name slot");

      StringRef methname = reloc->getReferentString();
      if (!ObjCSelRefsHelper::getSelRef(methname))
 ObjCSelRefsHelper::makeSelRef(methname);

      // Jump to method name offset in next struct
      methodNameOff += originalStructSize;
    }
 }
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVU1v4zYQ_TX0ZRBDpvx58MHr1NgtNgkQt-ixoMiRyIQiBXIUx_31BSnF67jbXhoEkkXOe_PmixQxmsYhbtniC1vcT0RP2ofti9fO-dlmySeVV-ftV8P4nhU7Vuy-Mb5qISIa14AAGUTUYI17Td-kTYSnDh0cfR8kQhf8C0oCTdRFVu4YPzB-aAzpvppK3zJ-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