Page MenuHomePhabricator

[llvm-objcopy][MachO] Add support for LC_CODE_SIGNATURE

Authored by alexshap on Jun 12 2020, 2:36 PM.



This diff adds support for copying binaries containing a LC_CODE_SIGNATURE load command .

Test plan: make check-all

Diff Detail

Event Timeline

alexshap created this revision.Jun 12 2020, 2:36 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: abrachet. · View Herald Transcript
alexshap updated this revision to Diff 270528.Jun 12 2020, 3:00 PM

Fix typo.

Not sure if this will also fix: "llvm-objcopy: error: unsupported load command (cmd=0x1d)" error.

hiraditya added a comment.EditedJun 13 2020, 7:00 AM

Thanks a lot for fixing this, this was blocking me earlier yesterday and @smeenai asked me to reach out to you.

MaskRay added inline comments.Jun 13 2020, 5:33 PM

Does this test need CHECK lines?

Looks reasonable on the surface, but I don't have the Mach-O knowledge to confirm it, so best get someone else to give the LGTM.


I don't think so, strictly? cmp does the job fine, since we know the load command is in the input (citation: presumably some yaml2obj test), and it does a binary diff.

That being said, a check line might be helpful to prevent user error in the input.

smeenai accepted this revision.Jun 15 2020, 5:27 PM

LGTM from the Mach-O side.


Typo: covention -> convention

IIRC the reason for this convention is that dyld3 assumes the text segment starts at file offset 0, so the Mach-O header is counted as part of the text segment. See the comment about dyld3 in Writer.cpp in D75382.


Does this comment need updating? It appears the code signature is at the end.


Typo: comamnd -> command

This revision is now accepted and ready to land.Jun 15 2020, 5:27 PM
alexshap marked an inline comment as done.Jun 15 2020, 5:52 PM
alexshap added inline comments.

yeah, thanks, I'll update the comment

alexshap updated this revision to Diff 270938.Jun 15 2020, 6:51 PM

Fix typos

This revision was automatically updated to reflect the committed changes.