[PATCH] D80099: [llvm-objcopy][MachO] Add support for removing Swift symbols

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 22:18:27 PDT 2020


alexshap added a comment.

Thank you for the question!

First, I checked in advance the documentation  https://sourceware.org/binutils/docs/binutils/strip.html - there is no conflict for this option, if one day this issue comes up, or, more generally, if one day we have to parse command-line options differently for different formats (in this case it might be MachO or COFF or ELF) then the approach used in llvm-objcopy/llvm-strip will have to be adjusted anyway. It looks like at the moment there is not urgency to rename this option (+ it would introduce some friction for users on OSX, they won't be able to seamlessly switch from cctools strip to llvm-strip, especially for large complex projects). Additionally, If this issues arise, I'm not sure renaming is really the right solution, although this question requires more thinking (i'm not ready to answer it right away). One can imagine several other options how to resolve this hypothetical issue without breaking the downstream users (or at least with much smaller disruption): either add a "new driver", or (similarly to llvm-objdump) add "--macho", there are other approaches as well (it's not the full list).

Second, to the best of my knowledge the support for MachO in binutils is fragmented (e.g. strip doesn't properly support MachO if I'm not mistaken) and even small bits which exist are outdated (e.g. after a very brief look I don't see any mentions of the load commands which were introduced in the iOS era).

For Apple platforms (iOS, OSX) it's common to use tools provided by Xcode, and (again, to the best of my knowledge) several important utilities (distributed by Xcode) (install-name-tool, strip, lipo, bitcode-strip) actually come from cctools. 
So to use llvm-strip in place of cctools' strip we need functional parity (at least to some extent). Moreover, having support for these features is also useful in some other cases. For example, in the past I used to work on Swift,
there are developers hacking on Swift which are using non-Apple platforms as their primary development environments, having such tools unblocks a number of use-cases 
(the most trivial one - running tests for MachO binaries (which don't require the actual runtime, e.g. various tools which parse / extract some information from object files) on non-OSX host platforms).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80099/new/

https://reviews.llvm.org/D80099





More information about the llvm-commits mailing list