Skip to content
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

Only no-op ld64.lld on Apple hosts #9698

Open
wants to merge 2 commits into
base: stable/20240723
Choose a base branch
from

Conversation

kabiroberai
Copy link

Following #8119, invoking ld64.lld results in the error This version of lld does not support linking for platform [macOS/iOS/...].

The rationale behind the original change was to make sure people don't accidentally use lld instead of dyld's ld64 on macOS, given that new macOS toolchains ship with lld for linking ELF binaries. However, this had the unintended effect of also making it impossible to cross-compile MachO binaries on Linux hosts with the Swift toolchain — a use case that is otherwise fully possible with Swift SDKs.

This PR updates the patch such that we only abort when linking Darwin binaries on Apple host platforms.

@MaxDesiatov
Copy link

@swift-ci test

@kabiroberai
Copy link
Author

heya @kubamracek, would be awesome if you could take a look at this! really hope we can land this in time to be cherry-picked into 6.1

@rauhul rauhul self-requested a review December 12, 2024 18:11
@@ -158,8 +158,10 @@ static bool checkCompatibility(const InputFile *input) {
return true;

// Swift LLVM fork downstream change start
#if defined(__APPLE__)
error("This version of lld does not support linking for platform " + getPlatformName(platformInfos.front().target.Platform));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a warning to say linking macho on via ld64.lld is unsupported and use at your own risk? (for non-apple)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants