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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 02:55:51 PDT 2018


jhenderson added a comment.

In https://reviews.llvm.org/D46874#1102755, @grimar wrote:

> > ! 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.


Ah okay, I haven't really worked with that area. I assume it's the same with other linkers? Because otherwise, I'd say it makes more sense to not have the special case.


https://reviews.llvm.org/D46874





More information about the llvm-commits mailing list