[PATCH] D36558: [llvm-objcopy] Add support for nested and overlapping segments

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 15:00:07 PDT 2017


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

1. Added condition to check for PT_GNU_STACK in layout because the new layout algorithm threw and error in the case
2. Added 3 test to try and get as much coverage of the O(n^2) loop over program headers. I tried to make sure every branch was covered.

Turning this into a library isn't really an option right now. Petr Hosek talked with Rui about the possibility of that in future. Namely LLD's synthetic sections and my sections look a lot alike so I think deduplicating those and merging them into a library makes a lot of sense at some point in the future but not right now. If this stuff gets turned into a library I think that's the form it will take.

I think we should probably settle for adding a few tests (possibly more, please recommend more if you can think of any) here and then wait to add some stripping capability next. After stripping is implemented we can write better tests. I plan on adding some stripping capabilities right after dynamic stuff has been submitted. I'll start writing code for it soon and put it up for review as soon as possible.

What kind of stripping would be most useful for testing at first? I think removing a section by name and then removing a symbol by name would be best. That way we can tailor tests to see what happens when specific sections/symbols are removed. After that we can implement more useful types of stripping that remove multiple sections and symbols at once.

So my proposal is the following:

1. Compromise between adding a bunch of very similar .test files and unit testing by adding a few more .test files (please recommend more) and waiting for better tests to come up after we have section and symbol removal
2. Write section removal by name next.
3. Write a collection of tests using section removal  works well and to get more test coverage
4. Write symbol removal by name after that.
5. Write a collection of tests using symbol removal to get better coverage.
6. Add more advanced kinds of stripping like --strip-all and --strip-debug


Repository:
  rL LLVM

https://reviews.llvm.org/D36558

Files:
  test/tools/llvm-objcopy/overlap-chain.test
  test/tools/llvm-objcopy/pt-phdr.test
  test/tools/llvm-objcopy/same-segment.test
  test/tools/llvm-objcopy/tripple-overlap.test
  tools/llvm-objcopy/Object.cpp
  tools/llvm-objcopy/Object.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36558.114075.patch
Type: text/x-patch
Size: 16492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170906/494e4c65/attachment-0001.bin>


More information about the llvm-commits mailing list