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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 11:04:36 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/OutputSections.cpp:210
                                        StringRef OutsecName) {
   // Sections with the SHT_GROUP attribute reach here only when the - r option
   // is given. Such sections define "section groups", and InputFiles.cpp has
----------------
s/- r/-r/


================
Comment at: ELF/OutputSections.cpp:215
   // creates broken section contents.
-  if (IS->Type == SHT_GROUP) {
+  // We also do not merge any SHF_GROUP sections because otherwise we
+  // end up with multiple SHT_GROUPs containing the same output section.
----------------
This comment is not correct. Assume that there's only one section group containing a section .foo, and there's other object file having a section .foo which is not a member of any section group. It'll end up with only one section group, but we still shouldn't merge the member .foo with non-member .foo, because it is semantically incorrect.


https://reviews.llvm.org/D37574





More information about the llvm-commits mailing list