[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 08:09:11 PDT 2018


grimar added a comment.

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

> Maybe I've been confusing things, because from what I'm seeing in this, there is now a unique stack sizes section for every function, even without -ffunction-sections, which I don't think we want.


That is not ideal, but safe, simple and correct I believe.

> What I kind of expect to see is this:
> 
> 1. Without function sections:
>   1. Non-COMDAT functions all share a stack_sizes section which refers via SHF_LINK_ORDER to .text.

But what about my sample?

  int foo() {
   return 0;
  }
  
  int main () __attribute__ ((section (".text.main")));
  int main() {
    return 0;
  }

This code compiled without -ffunction-sections will have 2 .text sections: `.text` and `.text.main`.
The current version of the patch would correctly create 2 unique stack sizes and would link them to `.text` and `.text.main`
respectively.

There is no way currently to create and link 2 different .stack_sizes to different .text sections without setting different unique ID to them I think.


https://reviews.llvm.org/D46874





More information about the llvm-commits mailing list