[PATCH] D37574: [ELF] - Do not merge sections from SHT_GROUP when -relocatable

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 02:41:53 PDT 2017


grimar added inline comments.


================
Comment at: ELF/OutputSections.cpp:254-262
   // Sections with the SHT_GROUP attribute reach here only when the - r option
   // is given. Such sections define "section groups", and InputFiles.cpp has
   // dedup'ed section groups by their signatures. For the -r, we want to pass
   // through all SHT_GROUP sections without merging them because merging them
   // creates broken section contents.
-  if (IS->Type == SHT_GROUP) {
+  // We also do not merge any SHF_GROUP sections with any others. If we would do
+  // that we either end up with multiple SHT_GROUP sections containing the
----------------
ruiu wrote:
> This comment becomes a bit too lengthy. Instead of appending more and more comments, it is sometimes better to rewrite. I'd rewrite this:
> 
> Sections with SHT_GROUP or SHF_GROUP attributes reach here only when the -r option is given. A section with SHT_GROUP defines a "section group", and its members have SHF_GROUP attribute. Usually these flags have already been stripped by InputFiles.cpp as section groups are processed and uniquified. However, for the -r option, we want to pass through all section groups as-is because adding/removing members or merging them with other groups change their semantics.
Thanks !


https://reviews.llvm.org/D37574





More information about the llvm-commits mailing list