OSDN Git Service

[llvm-objcopy] Add support for large indexes
authorJake Ehrlich <jakehehrlich@google.com>
Wed, 7 Mar 2018 19:59:15 +0000 (19:59 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Wed, 7 Mar 2018 19:59:15 +0000 (19:59 +0000)
commit96db657c27a25238adb6bcd47107b7bd400ba29b
treebc522c9fea36861db924f5c9405cb98cb47ffd21
parentb5e785a6cbed6166d2cc129f8c114d548e922562
[llvm-objcopy] Add support for large indexes

Because of -ffunction-sections (and maybe other use cases I'm not aware of?) it
can occur that we need more than 0xfeff sections but ELF dosn't support that
many sections. To solve this problem SHN_XINDEX exists and with it come a whole
host of changes for section indexes everywhere. This change adds support for
those cases which should allow llvm-objcopy to copy binaries that have an
arbitrary number of sections.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326940 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/Inputs/many-sections.o.zip [new file with mode: 0644]
test/tools/llvm-objcopy/auto-remove-shndx.test [new file with mode: 0644]
test/tools/llvm-objcopy/many-sections.test [new file with mode: 0644]
test/tools/llvm-objcopy/remove-shndx.test [new file with mode: 0644]
test/tools/llvm-objcopy/strict-no-add.test [new file with mode: 0644]
tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h