This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy][MachO] Ignore all LC_SUB_* commands.
ClosedPublic

Authored by drodriguez on Jul 20 2021, 4:50 PM.

Details

Summary

The LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA, LC_SUB_CLIENT, and LC_SUB_LIBRARY
are used to indicate related libraries, binaries or framework names.
Their only payload is the string with the name of the object. Adding
those commands to the list of ignored/skipped load commands will avoid
an error that stop the process of copying/stripping and will copy their
contents verbatim.

Additionally, in order to have a test for this case, yaml2obj now
allows those four commands to contain a PayloadString.

Diff Detail

Event Timeline

drodriguez created this revision.Jul 20 2021, 4:50 PM
drodriguez requested review of this revision.Jul 20 2021, 4:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2021, 4:50 PM
smeenai accepted this revision.Jul 25 2021, 10:12 PM

LGTM

llvm/test/tools/llvm-objcopy/MachO/sub-load-commands.test
7

Can we also cmp the before and after binaries? They should be identical, right?

This revision is now accepted and ready to land.Jul 25 2021, 10:12 PM
MaskRay accepted this revision.Jul 25 2021, 11:41 PM

I'll rename PayloadString to Content in D106759

I'll rename PayloadString to Content in D106759

Thanks. I will rename here, test again, and send and update.

llvm/test/tools/llvm-objcopy/MachO/sub-load-commands.test
7

I don't know. Probably. I will check and add the comparison if so.

  • Rebase
  • Use Content instead of PayloadString (adopting D106759)
  • Use cmp in the test to check that objcopy does a perfect copy.
drodriguez marked an inline comment as done.Jul 26 2021, 6:27 PM
This revision was landed with ongoing or failed builds.Jul 28 2021, 5:36 PM
This revision was automatically updated to reflect the committed changes.