[PATCH] D39697: Limit the maximum alignment of copyrel'ed shared symbols to 32.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 13:58:02 PST 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu created this revision.
> Herald added subscribers: arichardson, emaste.
>
> When we create a copy relocation, we need to compute its alignment.
> Since the information is lost already, we need to infer it from a
> symbol address.
>
> If a symbol seems to be aligned to a very large address, it is likely
> that it doesn't really need that alignment but it happens to get that
> address. So, for example, if a symbol's address is 6 GiB, it usually
> doesn't mean that it must be aligned to 2 GiB.
>
> This patch limits the maximum alignment to 32. 32 is chosen as a
> "reasonable" maximum alignment.

I really don't think we should do that.

Note that we take the minimum with the section alignment. So we only get
a crazy high value if both the address and the section have high
alignments.

We can compute the final value in 64 bits and then error if it is too
big.

Cheers,
Rafael


More information about the llvm-commits mailing list