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

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 12:20:36 PDT 2019


rupprecht created this revision.
rupprecht added reviewers: jakehehrlich, jhenderson, MaskRay.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a project: LLVM.

When llvm-objcopy sorts sections during finalization, it only sorts based on the offset, which can cause the group section to come after the sections it contains. This causes link failures when using gold to link objects created by llvm-objcopy.

Fix this for now by copying GNU objcopy's behavior of placing SHT_GROUP sections first. In the future, we may want to remove this sorting entirely to more closely preserve the input file layout.

This fixes https://bugs.llvm.org/show_bug.cgi?id=42052.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62620

Files:
  llvm/test/tools/llvm-objcopy/ELF/compress-debug-sections-zlib-gnu.test
  llvm/test/tools/llvm-objcopy/ELF/compress-debug-sections-zlib.test
  llvm/test/tools/llvm-objcopy/ELF/group-reorder.test
  llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test
  llvm/tools/llvm-objcopy/ELF/Object.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62620.202020.patch
Type: text/x-patch
Size: 7063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190529/84b90abe/attachment.bin>


More information about the llvm-commits mailing list