[PATCH] D68101: [MC][ELF] Prevent globals with an explicit section from being mergeable

ben via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 02:29:48 PST 2019


bd1976llvm added a comment.

In D68101#1766359 <https://reviews.llvm.org/D68101#1766359>, @rjmccall wrote:

> I can't speak for the pragma authors, but I strongly doubt the pragma is intended to force all affected globals to go into a single section unit, since the division into section units is purely an object-file representation issue.


I'm thinking of embedded platforms where there is no or only very primitive linkers. There is also the advantage of producing similar output to GCC. Creating multiple output sections is not without risk - for example, it means that symbols can be re-ordered (relative to their original order in source files) which could cause a change in behaviour.

Perhaps I am being too cautious - we have had bugs and reviews open for long enough for anyone interested to comment. The way forward now, I think, is to make a reasonable fix and see what breaks.

> Looks to me like `MCContext::getELFSection` should be including the entry size and flags as part of the uniquing key.

Agreed. I will update the patch to do that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68101/new/

https://reviews.llvm.org/D68101





More information about the cfe-commits mailing list