[PATCH] D62620: [llvm-objcopy] Fix SHT_GROUP ordering.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 21:56:10 PDT 2019

MaskRay added inline comments.

Comment at: llvm/test/tools/llvm-objcopy/ELF/group-reorder.test:1
+# RUN: yaml2obj %s > %t.o
+# RUN: llvm-objcopy %t.o %t.2.o
Regarding this test, I'm not sure if llvm-objcopy should repair the object file. It seems currently the only broken tool is us :( After this issue is fixed, the repair functionality may be use useful any more...

Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1643
+    // Put SHT_GROUP sections first, since group section headers must come
+    // before the sections they contain. This also matches what GNU objcopy
+    // does.
MaskRay wrote:
> > This also matches what GNU objcopy does.
> This is not accurate.. I suspect it just doesn't sort sections, unless in --pad-to= or --gap-fill= mode.
Sorry, GNU objcopy does move SHT_GROUP sections before.

bfd/elf.c:assign_section_numbers does this. It has a comment:

`      /* Put SHT_GROUP sections first.  */`

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list