[PATCH] D46874: [MC] - Add .stack_size sections into groups and link them with .text

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 23 04:02:47 PDT 2018


grimar added a comment.

In https://reviews.llvm.org/D46874#1109238, @jhenderson wrote:

> In https://reviews.llvm.org/D46874#1109198, @grimar wrote:
>
> > And observing the results, I think it is worth to stop doing unification when -ffunction-sections is off
> >  (to reduce the number of sections and possible linker slowdown).
> >
> > I'll update the patch.
>
>
> I agree, although with one caveat: COMDAT sections should always have a separate .stack_sizes section (maybe in their group), as otherwise we'll have the same invalid problem for discarded COMDATs as I mentioned earlier - i.e. their entries will be preserved, even though they are no longer present.


Sure, this is an optimization we want to keep. That does not require setting unique ID attribute. 
It is enough to place .stack_sizes into COMDAT. For example the following code will produce 3 different sections in a object:

  .section .stack_sizes,"aG", at progbits,foo,comdat
  nop
  
  .section .stack_sizes,"aG", at progbits,bar,comdat
  nop
  
  .section .stack_sizes,"", at progbits
  nop


https://reviews.llvm.org/D46874





More information about the llvm-commits mailing list