diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h --- a/lld/MachO/InputSection.h +++ b/lld/MachO/InputSection.h @@ -38,7 +38,7 @@ class InputSection { public: virtual ~InputSection() = default; - virtual size_t getSize() const { return data.size(); } + virtual uint64_t getSize() const { return data.size(); } virtual uint64_t getFileSize() const { return getSize(); } uint64_t getFileOffset() const; uint64_t getVA() const; diff --git a/lld/MachO/MergedOutputSection.h b/lld/MachO/MergedOutputSection.h --- a/lld/MachO/MergedOutputSection.h +++ b/lld/MachO/MergedOutputSection.h @@ -28,7 +28,7 @@ const InputSection *lastSection() const { return inputs.back(); } // These accessors will only be valid after finalizing the section - size_t getSize() const override { return size; } + uint64_t getSize() const override { return size; } uint64_t getFileSize() const override { return fileSize; } void mergeInput(InputSection *input) override; diff --git a/lld/MachO/OutputSection.h b/lld/MachO/OutputSection.h --- a/lld/MachO/OutputSection.h +++ b/lld/MachO/OutputSection.h @@ -37,7 +37,7 @@ uint64_t getSegmentOffset() const; // How much space the section occupies in the address space. - virtual size_t getSize() const = 0; + virtual uint64_t getSize() const = 0; // How much space the section occupies in the file. Most sections are copied // as-is so their file size is the same as their address space size. virtual uint64_t getFileSize() const { return getSize(); } diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h --- a/lld/MachO/SyntheticSections.h +++ b/lld/MachO/SyntheticSections.h @@ -53,7 +53,7 @@ MachHeaderSection(); void addLoadCommand(LoadCommand *); bool isHidden() const override { return true; } - size_t getSize() const override; + uint64_t getSize() const override; void writeTo(uint8_t *buf) const override; private: @@ -67,7 +67,7 @@ public: PageZeroSection(); bool isHidden() const override { return true; } - size_t getSize() const override { return PageZeroSize; } + uint64_t getSize() const override { return PageZeroSize; } uint64_t getFileSize() const override { return 0; } void writeTo(uint8_t *buf) const override {} }; @@ -84,7 +84,7 @@ bool isNeeded() const override { return !entries.empty(); } - size_t getSize() const override { return entries.size() * WordSize; } + uint64_t getSize() const override { return entries.size() * WordSize; } void writeTo(uint8_t *buf) const override { // Nothing to write, GOT contains all zeros at link time; it's populated at @@ -102,7 +102,7 @@ public: BindingSection(); void finalizeContents(); - size_t getSize() const override { return contents.size(); } + uint64_t getSize() const override { return contents.size(); } // Like other sections in __LINKEDIT, the binding section is special: its // offsets are recorded in the LC_DYLD_INFO_ONLY load command, instead of in // section headers. @@ -138,7 +138,7 @@ class StubsSection : public SyntheticSection { public: StubsSection(); - size_t getSize() const override; + uint64_t getSize() const override; bool isNeeded() const override { return !entries.empty(); } void writeTo(uint8_t *buf) const override; @@ -153,7 +153,7 @@ class StubHelperSection : public SyntheticSection { public: StubHelperSection(); - size_t getSize() const override; + uint64_t getSize() const override; bool isNeeded() const override; void writeTo(uint8_t *buf) const override; @@ -169,13 +169,13 @@ class ImageLoaderCacheSection : public InputSection { public: ImageLoaderCacheSection(); - size_t getSize() const override { return WordSize; } + uint64_t getSize() const override { return WordSize; } }; class LazyPointerSection : public SyntheticSection { public: LazyPointerSection(); - size_t getSize() const override; + uint64_t getSize() const override; bool isNeeded() const override; void writeTo(uint8_t *buf) const override; }; @@ -184,7 +184,7 @@ public: LazyBindingSection(); void finalizeContents(); - size_t getSize() const override { return contents.size(); } + uint64_t getSize() const override { return contents.size(); } uint32_t encode(const DylibSymbol &); // Like other sections in __LINKEDIT, the lazy binding section is special: its // offsets are recorded in the LC_DYLD_INFO_ONLY load command, instead of in @@ -203,7 +203,7 @@ public: ExportSection(); void finalizeContents(); - size_t getSize() const override { return size; } + uint64_t getSize() const override { return size; } // Like other sections in __LINKEDIT, the export section is special: its // offsets are recorded in the LC_DYLD_INFO_ONLY load command, instead of in // section headers. @@ -221,7 +221,7 @@ StringTableSection(); // Returns the start offset of the added string. uint32_t addString(StringRef); - size_t getSize() const override { return size; } + uint64_t getSize() const override { return size; } // Like other sections in __LINKEDIT, the string table section is special: its // offsets are recorded in the LC_SYMTAB load command, instead of in section // headers. @@ -246,7 +246,7 @@ SymtabSection(StringTableSection &); void finalizeContents(); size_t getNumSymbols() const { return symbols.size(); } - size_t getSize() const override; + uint64_t getSize() const override; // Like other sections in __LINKEDIT, the symtab section is special: its // offsets are recorded in the LC_SYMTAB load command, instead of in section // headers. diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -45,7 +45,7 @@ sizeOfCmds += lc->getSize(); } -size_t MachHeaderSection::getSize() const { +uint64_t MachHeaderSection::getSize() const { return sizeof(mach_header_64) + sizeOfCmds; } @@ -138,7 +138,7 @@ StubsSection::StubsSection() : SyntheticSection(segment_names::text, "__stubs") {} -size_t StubsSection::getSize() const { +uint64_t StubsSection::getSize() const { return entries.size() * target->stubSize; } @@ -158,7 +158,7 @@ StubHelperSection::StubHelperSection() : SyntheticSection(segment_names::text, "__stub_helper") {} -size_t StubHelperSection::getSize() const { +uint64_t StubHelperSection::getSize() const { return target->stubHelperHeaderSize + in.stubs->getEntries().size() * target->stubHelperEntrySize; } @@ -200,7 +200,7 @@ flags = S_LAZY_SYMBOL_POINTERS; } -size_t LazyPointerSection::getSize() const { +uint64_t LazyPointerSection::getSize() const { return in.stubs->getEntries().size() * WordSize; } @@ -281,7 +281,7 @@ align = WordSize; } -size_t SymtabSection::getSize() const { +uint64_t SymtabSection::getSize() const { return symbols.size() * sizeof(structs::nlist_64); }