[PATCH] D56437: Support blank flag in SHT_GROUP sections for ELF

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 9 02:42:29 PST 2019


peter.smith added a comment.

I can confirm that the group sections are coming from the annobin tool.
>From the man page: https://www.mankier.com/1/annobin

  "attach""no-attach"
  When gcc compiles code with the -ffunction-sections option active it will place each function into its own section.  When the annobin attach option is active the plugin will attempt to attach the function section to a group containing the notes and relocations for the function.  In that way, if the linker decides to discard the function, it will also know that it should discard the notes and relocations as well.
  
  The default is to enable attach, but the inverse option is available in case the host assembler does not support the .attach_to_group pseudo-op.  If this feature is disabled then note generation for function sections will not work properly.

>From https://developers.redhat.com/blog/2018/02/20/annobin-storing-information-binaries/ this appears to be on by default when building Redhat packages.

Both gold and ld.bfd appear to take into account groups when doing garbage collection.  As it stands the patch would permit programs to link correctly, but if --gc-sections were on then LLD's implementation wouldn't throw away the .gnu.build.attributes sections (they are not SHF_ALLOC so are always marked live). This would lead to the tools that read the build information potentially giving incorrect results for some programs. How much of a problem this is would depend on the program, and how widely the watermark system is deployed.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56437/new/

https://reviews.llvm.org/D56437





More information about the llvm-commits mailing list