Skip to content

Commit

Permalink
Revert "[lld-macho] Warn on method name collisions from category defi…
Browse files Browse the repository at this point in the history
…nitions"

This reverts commit ef12275.

Apparently it is causing some crashes:
https://reviews.llvm.org/D142916#4178869
  • Loading branch information
int3 committed Mar 8, 2023
1 parent 19afbfe commit ecad968
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 629 deletions.
2 changes: 0 additions & 2 deletions lld/MachO/Driver.cpp
Expand Up @@ -1920,8 +1920,6 @@ bool macho::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
if (config->deadStrip)
markLive();

objc::checkCategories();

// ICF assumes that all literals have been folded already, so we must run
// foldIdenticalLiterals before foldIdenticalSections.
foldIdenticalLiterals();
Expand Down
9 changes: 6 additions & 3 deletions lld/MachO/InputFiles.cpp
Expand Up @@ -1272,10 +1272,13 @@ static CIE parseCIE(const InputSection *isec, const EhReader &reader,
}
}
if (personalityAddrOff != 0) {
const auto *personalityReloc = isec->getRelocAt(personalityAddrOff);
if (!personalityReloc)
auto personalityRelocIt =
llvm::find_if(isec->relocs, [=](const macho::Reloc &r) {
return r.offset == personalityAddrOff;
});
if (personalityRelocIt == isec->relocs.end())
reader.failOn(off, "Failed to locate relocation for personality symbol");
cie.personalitySymbol = personalityReloc->referent.get<macho::Symbol *>();
cie.personalitySymbol = personalityRelocIt->referent.get<macho::Symbol *>();
}
return cie;
}
Expand Down
17 changes: 0 additions & 17 deletions lld/MachO/InputSection.cpp
Expand Up @@ -135,14 +135,6 @@ std::string InputSection::getSourceLocation(uint64_t off) const {
return {};
}

const Reloc *InputSection::getRelocAt(uint32_t off) const {
auto it = llvm::find_if(
relocs, [=](const macho::Reloc &r) { return r.offset == off; });
if (it == relocs.end())
return nullptr;
return &*it;
}

void ConcatInputSection::foldIdentical(ConcatInputSection *copy) {
align = std::max(align, copy->align);
copy->live = false;
Expand Down Expand Up @@ -267,15 +259,6 @@ const StringPiece &CStringInputSection::getStringPiece(uint64_t off) const {
return const_cast<CStringInputSection *>(this)->getStringPiece(off);
}

size_t CStringInputSection::getStringPieceIndex(uint64_t off) const {
if (off >= data.size())
fatal(toString(this) + ": offset is outside the section");

auto it =
partition_point(pieces, [=](StringPiece p) { return p.inSecOff <= off; });
return std::distance(pieces.begin(), it) - 1;
}

uint64_t CStringInputSection::getOffset(uint64_t off) const {
const StringPiece &piece = getStringPiece(off);
uint64_t addend = off - piece.inSecOff;
Expand Down
9 changes: 0 additions & 9 deletions lld/MachO/InputSection.h
Expand Up @@ -55,8 +55,6 @@ class InputSection {
// Return the source line corresponding to an address, or the empty string.
// Format: Source.cpp:123 (/path/to/Source.cpp:123)
std::string getSourceLocation(uint64_t off) const;
// Return the relocation at \p off, if it exists. This does a linear search.
const Reloc *getRelocAt(uint32_t off) const;
// Whether the data at \p off in this InputSection is live.
virtual bool isLive(uint64_t off) const = 0;
virtual void markLive(uint64_t off) = 0;
Expand Down Expand Up @@ -220,10 +218,6 @@ class CStringInputSection final : public InputSection {
return toStringRef(data.slice(begin, end - begin));
}

StringRef getStringRefAtOffset(uint64_t off) const {
return getStringRef(getStringPieceIndex(off));
}

// Returns i'th piece as a CachedHashStringRef. This function is very hot when
// string merging is enabled, so we want to inline.
LLVM_ATTRIBUTE_ALWAYS_INLINE
Expand All @@ -238,9 +232,6 @@ class CStringInputSection final : public InputSection {

bool deduplicateLiterals = false;
std::vector<StringPiece> pieces;

private:
size_t getStringPieceIndex(uint64_t off) const;
};

class WordLiteralInputSection final : public InputSection {
Expand Down
74 changes: 0 additions & 74 deletions lld/MachO/Layout.h

This file was deleted.

0 comments on commit ecad968

Please sign in to comment.