-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt] Don't explicitly ad-hoc code sign dylibs if using Apple's new linker #88323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…'s new linker Apple's new linker reports itself as ld rather than ld64 and does not match the version detection regex. Invert the logic to look only for older versions of ld64. This ensures the runtime dylibs are left with a linker-generated code signature that tools such as `strip` will preserve.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but lets wait for @yln
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change makes sense to me, thanks!
TIL: linker ad-hoc codesigns by default
man ld
...
-adhoc_codesign
Directs the linker to add an ad-hoc codesignature to the output file. The default for Apple Silicon binaries is to be ad-hoc codesigned.
@bdash Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Just a heads up @bdash , this causes a bug on my system where I can't run Reverting the change in this PR fixes the issue. Showing the bug:
Replicating the important line:
This file exists, but is unsigned. Let me know what diagnostic information I can get for you, happy to help track it down :) Some things to possibly help get things started, logging from cmake:
Other info:
Let me know what else you need. |
I will look into it. |
Thanks, just shout if you want me to test a fix! Happy to help
…On Fri, May 3, 2024 at 2:44 PM, Mark Rowe ***@***.***(mailto:On Fri, May 3, 2024 at 2:44 PM, Mark Rowe <<a href=)> wrote:
I will look into it.
—
Reply to this email directly, [view it on GitHub](#88323 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ADMDXY73AJGK4QPV563HFFLZAQANFAVCNFSM6AAAAABGBGBF5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJTHAYDENZQHE).
You are receiving this because you commented.Message ID: ***@***.***>
|
In llvm#88323, I changed the logic within `add_compiler_rt_runtime` to only explicitly code sign the resulting library if an older version of Apple's ld64 was in use. This was based on the assumption that newer versions of ld64 and the new Apple linker always ad-hoc sign their output binaries. This is true in most cases, but not when using Apple's new linker with the '-darwin-target-variant' flag to build Mac binaries that are compatible with Catalyst. Rather than adding increasingly complicated logic to detect the exact scenarios that require explicit code signing, I've opted to always explicitly code sign when using any Apple linker. We instead detect and use the 'linker-signed' codesigning option when possible to match the signatures that the linker would otherwise create. This avoids having non-'linker-signed' ad-hoc signatures which was the underlying problem that llvm#88323 intended to address.
…#91681) In #88323, I changed the logic within `add_compiler_rt_runtime` to only explicitly code sign the resulting library if an older version of Apple's ld64 was in use. This was based on the assumption that newer versions of ld64 and the new Apple linker always ad-hoc sign their output binaries. This is true in most cases, but not when using Apple's new linker with the `-darwin-target-variant` flag to build Mac binaries that are compatible with Catalyst. Rather than adding increasingly complicated logic to detect the exact scenarios that require explicit code signing, I've opted to always explicitly code sign when using any Apple linker. We instead detect and use the 'linker-signed' codesigning option when possible to match the signatures that the linker would otherwise create. This avoids having non-'linker-signed' ad-hoc signatures which was the underlying problem that #88323 was intended to address. Co-authored-by: Mark Rowe <[email protected]>
Apple's new linker reports itself as ld rather than ld64 and does not match the version detection regex.
Invert the logic to look only for older versions of ld64. This ensures the runtime dylibs are left with a linker-generated code signature that tools such as
strip
will preserve.