This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Invoke strip without -l and with non-grouped flags.
ClosedPublic

Authored by drodriguez on Jun 30 2021, 4:06 PM.

Details

Summary

llvm-strip does not support -l. Apple's strip supports -l, but
it is not documented, and the latest code doesn't seem to do anything
meaningful. From the old source code drops it seems that -l was added
around version 795 of cctools and removed before 898. The code around
the flag usage in 795 talks about problems with kext and forcing the
execution of ld -r, which seems a behaviour that is not enforceable in
latest versions of cctools.

The -l flag was added in https://reviews.llvm.org/D15133 without a lot
of explanation.

Since the flag is not active, removing it should not modify the
behaviour for most people (except if someone is trying to compile LLVM
with a really old version of strip).

Additionally, break the invocation into two different flags, since
llvm-strip doesn't at the moment support grouped flags, and other
strip implementations should work the same no matter if grouped or
not.

Test Plan:

Using strip from Xcode 12.5 in Big Sur to strip the same binary (a
simple Hello World), using both -Sxl and -Sx produces exactly the
same binary.

Repeating the same process with clang results also in the same binary.

Diff Detail

Event Timeline

drodriguez created this revision.Jun 30 2021, 4:06 PM
drodriguez requested review of this revision.Jun 30 2021, 4:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2021, 4:06 PM
smeenai accepted this revision.Jun 30 2021, 4:12 PM

LGTM

We should fix llvm-strip to accept grouped flags, but the other side of this branch was already using non-grouped flags anyway :)

This revision is now accepted and ready to land.Jun 30 2021, 4:12 PM

https://reviews.llvm.org/D105249 adds the support for grouped options. I will keep the options separated in this commit (if nobody has any concerns), since it seems more portable at this point.

This revision was landed with ongoing or failed builds.Jul 1 2021, 1:38 PM
This revision was automatically updated to reflect the committed changes.