OSDN Git Service

[llvm-objcopy] Implement support for section groups
authorAlexander Shaposhnikov <shal1t712@gmail.com>
Wed, 21 Mar 2018 19:53:44 +0000 (19:53 +0000)
committerAlexander Shaposhnikov <shal1t712@gmail.com>
Wed, 21 Mar 2018 19:53:44 +0000 (19:53 +0000)
commit36cdb40ffa9ffe8b1166dd784c5ab4e21fa4d70d
tree67f1e8bc9bc3650cca23c202389a3ebd535847f4
parent6790638696e8730c36392104f96c4fbfad5120e0
[llvm-objcopy] Implement support for section groups

This diff adds support for SHT_GROUP sections to llvm-objcopy.
Some sections are interrelated and comprise a group.
For example, a definition of an inline function might require,
in addition to the section containing its instructions,
a read-only data section containing literals referenced inside the function.
A section of the type SHT_GROUP contains the indices of the group members,
therefore, it needs to be updated whenever the indices change.
Similarly, the fields sh_link, sh_info should be recalculated as well.

[Resubmit r328012 with the proper handling of endianness]

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D43996

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328143 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/Inputs/groups.o [new file with mode: 0644]
test/tools/llvm-objcopy/group-big-endian.test [new file with mode: 0644]
test/tools/llvm-objcopy/group-unchanged.test [new file with mode: 0644]
test/tools/llvm-objcopy/group.test [new file with mode: 0644]
test/tools/llvm-objcopy/strip-dwo-groups.test [new file with mode: 0644]
tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h