[PATCH] D37915: [llvm-objcopy] Add support for dynamic relocations

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 17:40:17 PDT 2017


jakehehrlich updated this revision to Diff 115764.
jakehehrlich added a comment.

Used James' idea along with https://reviews.llvm.org/D38008 to factor out almost all code duplication. Thanks James!

A couple points on the precise choices I made:

1. I don't want to just pass a vector because the only way to pass a vector/array is to copy the pointers into a new array or to pass an array of unique pointers.
2. I don't want to make the getSection* methods public but that's kind of a small point
3. Because Object takes an ELFT parameter we can't have it be an argument to a virtual method. So something without the ELFT template dependency has to be passed.

The result is that a new type needs to be made and it handles retrieving sections by index. I'm fairly happy with the overall choice here. A slight blemish is that a few of the types need special initialization beyond setting link/info fields. But there are only two of those so far (SymbolTableSection and RelocationSection) and the only other one I anticipate will ever occur is for SHT_GROUP which isn't a concern right now.


Repository:
  rL LLVM

https://reviews.llvm.org/D37915

Files:
  test/tools/llvm-objcopy/Inputs/dynrel.elf
  test/tools/llvm-objcopy/dynamic-relocations.test
  tools/llvm-objcopy/Object.cpp
  tools/llvm-objcopy/Object.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37915.115764.patch
Type: text/x-patch
Size: 5632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/cf417fef/attachment.bin>


More information about the llvm-commits mailing list