[PATCH] D17817: [ELF] do not allow .bss to occupy the file space when producing relocatable output.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 12:15:53 PST 2016


On Thu, Mar 3, 2016 at 12:02 PM, George Rimar <grimar at accesssoftek.com>
wrote:

> >The spec is pretty much vague at this point -- it is not clear what "the
> conceptual placement" means and what it should be.
> >
> >That being said, I'm not entirely against setting a file offset to the
> bss section. But the two if's don't look good. It probably needs some
> explanation, but the explanation is that "bss >section should point to its
> conceptual placement", which doesn't really explain the reason that much.
> So, how about this?
> >
> >  for (OutputSectionBase<ELFT> *Sec : OutputSections) {
> >    FileOff = alignTo(FileOff, Sec->getAlign());
> >    Sec->setFileOffset(FileOff);
> >    FileOff += Sec->getSize();
> >  }
>
> That the same how it was before the patch :)
> ​But the point was that .bss should not occupy the space in file. Without
> that for example tescase for the patch would generate 5 magabytes output
> what we can and want to avoid, don't we ?
>

LGTM

Huh, I was thinking that getSize() returns zero for the bss section, but
that was not true. I'm not still very satisfied with the code, but looks
like it is actually a reasonable approach. Thank you for doing this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160303/d4af010a/attachment.html>


More information about the llvm-commits mailing list