[PATCH] D111164: Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations
Daniel RodrÃguez Troitiño via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 13 17:07:08 PDT 2021
drodriguez added a comment.
In D111164#3052797 <https://reviews.llvm.org/D111164#3052797>, @alexander-shaposhnikov wrote:
> adding / removing load commands (e.g. rpath) can trigger such changes (but beware the alignment + the order of load commands matters) so the test needs to be specifically designed for these purposes
>
> (I would use llvm-objdump or llvm-readobj to verify that the offset of __TEXT has changed etc)
>
> P.S. btw - you probably want to update TextSegmentCommandIndex inside updateLoadCommandIndexes(..) and such a test would catch it, alternatively, it can be calculated where it's actually used (and the field can be dropped)
OK. We have been looking at what you were pointing out in this comment, and we want to run the plan by you (and anyone else reading), so we don't detour very far.
- Fix `updateLoadCommandIndex(...)` to handle both the new `TextSegmentCommandIndex` and also `CodeSignatureCommandIndex` (this is an error introduced before Nuri touched anything, but since we are fixing things, we better fix both).
- Write a test that tries to exercise that code:
- Create a binary with `yaml2obj` having a `LC_CODE_SIGNATURE` to start triggering all the new code.
- Execute something like `llvm-install-name-tool -prepend_rpath foo/bar`. Analyze that the resulting binary has the right signature. Also check that the text segment has a new offset.
- Execute something like `llvm-install-name-tool -remove_rpath foo/bar` that removes the previously prepended rpath. Do the same checks as above.
Do you think that would be enough? Were you thinking in something different?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111164/new/
https://reviews.llvm.org/D111164
More information about the llvm-commits
mailing list