[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
Thu May 17 02:14:51 PDT 2018


grimar added a comment.

> ! In https://reviews.llvm.org/D46874#1102740, @jhenderson wrote:
> 
>> ! In https://reviews.llvm.org/D46874#1102734, @grimar wrote:
>>  And renaming to something like `.stack_sizes.XXX` would require linker side change to place them into the single output section I think,
>>  as currently they are merged by name, just like other regular sections.
> 
> This surprises me. I thought that default grouping would match up to the first '.', like it does for e.g. .text or .data grouping (i.e. .text.foo and .text.bar end up in .text). Or are some sections special-cased for this?

Yes, `.text.*`, `.data.*` and few others are a special case. See LLD code for that:

https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L124

  for (StringRef V :
       {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.",
        ".bss.", ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
        ".gcc_except_table.", ".tdata.", ".ARM.exidx.", ".ARM.extab."}) {
    if (isSectionPrefix(V, S->Name))
      return V.drop_back();
  }

The default behavior is to group by name.


https://reviews.llvm.org/D46874





More information about the llvm-commits mailing list