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

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 09:46:08 PST 2019


peter.smith added a comment.

For some background, the static glibc.a in the latest (unreleased) build of Fedora contains these non-comdat group sections.

There are 2 types of group, one called .text.unliklely.group (unlikely is spelled wrongly in the object files) and one called .text.hot.group. The .text.unlikely and .text.hot sections usually come about when the gcc optimizations like -freorder-blocks-and-partition and  -freorder-functions are used. However I've never seen them generate an ELF group before, I can't for the life of me reproduce with trunk gcc, and I can't find them in the source code. Looking at the objects in the glibc-static-2.28.9000-28.fc30.i686.rpm I can see a .text.unliklely.group with these contents:

  .text.unliklely
  .gnu.build.attributes.unliklely
  .rel.gnu.build.attributes.unliklely
  .gnu.build.attributes..text.unliklely
  .rel.gnu.build.attributes..text.unliklely
  .text.unliklely
  .text.unliklely
  .text.unliklely.zzz

I think that the .gnu.build.attributes sections are not yet part of gcc trunk. There is a plugin mentioned in https://fedoraproject.org/wiki/Toolchain/Watermark so it is possible that these groups are only used when this plugin is used. As this is glibc then it would make lld unusable on the latest Fedora distributions. It would be good to try and find out why these groups are being created and whether it is down to the gcc plugin https://bugzilla.redhat.com/show_bug.cgi?id=1451407 mentioned in the Watermark link.

I've not had a chance to look over the code in fine detail yet. At a quick glance:

- I think the approach of just loading the sections is fine.
- I suggest writing the test in assembler as we tend to use that unless an object can't be built using it. It would need .section .text.foo, "axG", @progbits, .group to create the non comdat group.


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