[lld] r316280 - Assume that mergeable input sections are smaller than 4 GiB.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 13:47:57 PDT 2017


SectionPiece maps input offsets to output offsets, and InputOff can be
greater than 4 GiB if its input section is greater than 4 GiB.

On Mon, Oct 30, 2017 at 11:53 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:
>
> >  template <class ELFT>
> >  MergeInputSection::MergeInputSection(ObjFile<ELFT> *F,
> >                                       const typename ELFT::Shdr *Header,
> >                                       StringRef Name)
> > -    : InputSectionBase(F, Header, Name, InputSectionBase::Merge) {}
> > +    : InputSectionBase(F, Header, Name, InputSectionBase::Merge) {
> > +  // In order to reduce memory allocation, we assume that mergeable
> > +  // sections are smaller than 4 GiB, which is not an unreasonable
> > +  // assumption as of 2017.
> > +  if (Data.size() > UINT32_MAX)
> > +    error(toString(this) + ": section too large");
> > +}
>
> Unless I am missing something, nothing in the code actually fails if a
> section is larger than 4GB, only if a SectionPiece is that big, no?
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171030/69016997/attachment.html>


More information about the llvm-commits mailing list