HomePhabricator

[llvm-objcopy] Fix SHT_GROUP ordering.

Description

[llvm-objcopy] Fix SHT_GROUP ordering.

Summary:
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.

Reviewers: jakehehrlich, jhenderson, MaskRay, espindola, alexshap

Reviewed By: MaskRay

Subscribers: phuongtrang148993, emaste, arichardson, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62620

Details

Committed
rupprechtJun 10 2019, 11:35 AM
Reviewer
MaskRay
Differential Revision
D62620: [llvm-objcopy] Fix SHT_GROUP ordering.
Parents
rL362972: [Analysis] add unit test file for VectorUtils; NFC
Branches
Unknown
Tags
Unknown