[PATCH] D42872: Fix handling of zero-size segments in llvm-objcopy

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 20:10:07 PST 2018


jakehehrlich added a comment.

What tells us that a segment is a marker segment? I think FileSize == 0 is probably a good choice but I want to make sure we don't later have to come back and fix this.

As I see it there are a few issues with what I originally wrote

1. My code assumes that the only way a program header will have offset zero is if there is a PT_PHDR header. We should probably check for a PT_PHDR header and follow the ParentSegment pointers up until its a nullptr to get the proper starting offset
2. My code assigns offsets to program headers that shouldn't have offsets assigned to them (like PT_GNU_STACK). We should either make a general rule like "if FileSize == 0 then don't assign an offset" or we should keep a list of program header types that should be excluded.

Also, please add a test to make sure I don't mess this up in the future.


Repository:
  rL LLVM

https://reviews.llvm.org/D42872





More information about the llvm-commits mailing list