diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index f6a0b5296cd7a4..4d3b889586e203 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -188,7 +188,6 @@ static bool checkCompatibility(const InputFile *input) { // Open a given file path and return it as a memory-mapped file. Optional macho::readFile(StringRef path) { - // Open a file. ErrorOr> mbOrErr = MemoryBuffer::getFile(path); if (std::error_code ec = mbOrErr.getError()) { error("cannot open " + path + ": " + ec.message()); @@ -209,10 +208,9 @@ Optional macho::readFile(StringRef path) { return mbref; } - // Object files and archive files may be fat files, which contains - // multiple real files for different CPU ISAs. Here, we search for a - // file that matches with the current link target and returns it as - // a MemoryBufferRef. + // Object files and archive files may be fat files, which contain multiple + // real files for different CPU ISAs. Here, we search for a file that matches + // with the current link target and returns it as a MemoryBufferRef. const auto *arch = reinterpret_cast(buf + sizeof(*hdr)); for (uint32_t i = 0, n = read32be(&hdr->nfat_arch); i < n; ++i) { diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h index 94c24a736b197c..4655e339439493 100644 --- a/lld/MachO/InputSection.h +++ b/lld/MachO/InputSection.h @@ -19,18 +19,17 @@ namespace lld { namespace macho { class InputFile; -class InputSection; class OutputSection; class InputSection { public: virtual ~InputSection() = default; virtual uint64_t getSize() const { return data.size(); } - virtual uint64_t getFileSize() const; + uint64_t getFileSize() const; uint64_t getFileOffset() const; uint64_t getVA() const; - virtual void writeTo(uint8_t *buf); + void writeTo(uint8_t *buf); InputFile *file = nullptr; StringRef name; diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index 2b63b839c0743e..2ff93556b46b7e 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -925,6 +925,9 @@ void StringTableSection::writeTo(uint8_t *buf) const { } } +static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0, ""); +static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0, ""); + CodeSignatureSection::CodeSignatureSection() : LinkEditSection(segment_names::linkEdit, section_names::codeSignature) { align = 16; // required by libstuff diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h index d5bc8ad6a56e3d..24be151690b067 100644 --- a/lld/MachO/SyntheticSections.h +++ b/lld/MachO/SyntheticSections.h @@ -16,7 +16,6 @@ #include "OutputSegment.h" #include "Target.h" -#include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SetVector.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" @@ -515,9 +514,6 @@ class BitcodeBundleSection : public SyntheticSection { uint64_t xarSize; }; -static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0, ""); -static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0, ""); - struct InStruct { MachHeaderSection *header = nullptr; RebaseSection *rebase = nullptr;