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

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 11:05:23 PDT 2019


bd1976llvm added a comment.

In D68101#1684828 <https://reviews.llvm.org/D68101#1684828>, @jmolloy wrote:

> This feels like it could cause a pretty serious regression. This essentially disables global merging with -fdata-sections, which I know at least one linker relies upon for code size.


My understanding is that -fdata-sections is just an option that affects the section selection for a global. My intent was that this change would only affect globals that have been assigned to a specific section via an attribute or the section property... to put it another way there appears to ab no effect on the IR from adding -fdata-sections to clang so I don't understand how this change could effect this... no?

In D68101#1685436 <https://reviews.llvm.org/D68101#1685436>, @SjoerdMeijer wrote:

> Hello James! Thanks for informing us. If this does what you say, it essentially disables global merging with -fdata-sections, then indeed we would get a little bit unhappy about that.
>  I could run some numbers with this patch, but I can guess what the outcome will be..... I haven't looked at this patch or the PR, but does this need to be default behaviour, or can this e.g. be done under an option?


I can see that this could cause performance problems if you were relying on the merging. I feel strongly that the behaviour in this patch (which matches GCC) should be the default, however I don't really have an objection to adding an option to re-enable merging. Please have a look at https://reviews.llvm.org/D68147 where I have attempted to do that.


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

https://reviews.llvm.org/D68101





More information about the llvm-commits mailing list