Skip to content

[lld] crash linking OSS https://github.com/Ranchero-Software/NetNewsWire #146658

Open
@johnno1962

Description

@johnno1962

Hi,

I'm seeing a crash linking this Open Source project https://github.com/Ranchero-Software/NetNewsWire. The crash occurs here in lld/MachO/SyntheticSections.cpp building RelWithDebInfo off 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;
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]lld:MachO

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions