RFC: New gas directive: .attach_to_group

Fangrui Song i@maskray.me
Tue Sep 29 16:53:17 GMT 2020


On 2020-09-29, Nick Clifton via Binutils wrote:
>Hi Guys,
>
>  I am planning on applying the attached patch, but I wondered if anyone
>  had any comments or thoughts first.
>
>  The patch adds a new gas directive: ".attach_to_group <name>" which
>  can be used to attach the current section to a named group.  I need
>  this functionality for the annobin plugin for gcc.  The plugin creates
>  new note sections and it wants to place them into section groups with
>  their associated code section.  (So the .annobin.text section is
>  grouped with the .text section, the .annobin.text.hot section is
>  grouped with the .text.hot section and so on).  The problem is that
>  the compiler creates the .section directives for (most of) these code
>  sections, and it does not add a group section to their declaration.
>  So I need a way to retroactively add a section to a group.  Hence the
>  new directive.
>
>  Tested with a wide variety of different configurations and no
>  problems.
>
>  Thoughts ?

Hi Nick,

Is this directive an extension to the existing feature: ?

   .section .text.foo,"axG",@progbits,group
   
   .section .rodata.foo,"a?"

If the section group intention of .annobin.text is so that .annobin.text
can be discarded if the associated .text is discarded (--gc-sections),
an alternative is SHF_LINK_ORDER

   HJ has done much work on this.
   There are a few additions:
   https://sourceware.org/pipermail/binutils/2020-August/112732.html


More information about the Binutils mailing list