[PATCH] D39713: [llvm-objcopy] Change -O binary to respect section removal and behave like GNU objcopy

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 18:56:03 PST 2017


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

Whoops! Turns out I added a bug in this change where certain kinds of cycles in ParentSegment could form because there wasn't a check to make sure that compareSegments(Parent, Child) held if Child->ParentSegment was nullptr. This caused -O binary to fail in our kernel dump. I fixed this and added a test case. Additionally the way I modified the first segment wasn't exactly right.

@jhenderson could you please review the additional changes I made?

1. Added additional compareSegment check to make sure that bad ParentSegments are not set
2. Set alignment to zero because sometimes the first used segment won't even have an OriginalOffset and Align that let's us place it at offset 0x0 but we need to force that to happen regardless. This is also checked by the new test.


Repository:
  rL LLVM

https://reviews.llvm.org/D39713

Files:
  test/tools/llvm-objcopy/binary-remove-all-but-one.test
  test/tools/llvm-objcopy/binary-remove-end.test
  test/tools/llvm-objcopy/binary-remove-middle.test
  test/tools/llvm-objcopy/parent-loop-check.test
  test/tools/llvm-objcopy/two-seg-remove-end.test
  test/tools/llvm-objcopy/two-seg-remove-first.test
  test/tools/llvm-objcopy/two-seg-remove-third-sec.test
  tools/llvm-objcopy/Object.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39713.122762.patch
Type: text/x-patch
Size: 22561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/6eaf094e/attachment.bin>


More information about the llvm-commits mailing list