[PATCH] D23661: [ELF] Fix sorting in combrelocs mode and add DT_REL(A)COUNT to .dynamic

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 14:11:48 PDT 2016


Yes, it says that the field is optional, but it doesn't say that it should
be interpreted as zero if absent. So it seems to me that writing zero is
the right thing if it is actually zero.

On Mon, Aug 29, 2016 at 2:06 PM, Eugene Leviant <evgeny.leviant at gmail.com>
wrote:

> evgeny777 added inline comments.
>
> ================
> Comment at: ELF/OutputSections.cpp:672-674
> @@ -664,1 +671,5 @@
> +
> +    size_t NumRelativeRels = Out<ELFT>::RelaDyn->getRelativeRelocCount();
> +    if (Config->ZCombreloc && NumRelativeRels)
> +      Add({IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels});
>    }
> ----------------
> ruiu wrote:
> > I'm not sure if it is the right thing to not emit DT_REL[A]COUNT if
> there are no relative relocations. If the number of relative relocations is
> zero, shouldn't we write zero?
> This doc:
> https://docs.oracle.com/cd/E19957-01/806-0641/6j9vuqujs/index.html
>
> Says that DT_RELACOUNT is an optional field. Our dynamic linker assumes
> that number of relative relocs is zero, unless there is a DT_REL(A)COUNT
> tag. That said, I don't see any reason for writing it always.
>
>
> https://reviews.llvm.org/D23661
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160829/c4d18246/attachment.html>


More information about the llvm-commits mailing list