Skip to content

Conversation

@egorzhdan
Copy link
Contributor

This fixes a regression where projects that use the C++ stdlib overlay stop building because of a linker error:

ld: Shared cache eligible dylib cannot link to ineligible dylib '@rpath/libswiftCompatibilitySpan.dylib'.

Usages of Span<T> would generally cause a type metadata accessor to be emitted for Swift.Span. This becomes a problem with backdeployment, since Span is partially defined in a compatibility binary.

This change adds @_alwaysEmitIntoClient to generic usages of Span to prevent the type metadata accessor from being emitted into libswiftCxx.a.

rdar://152192080

…he overlay

This fixes a regression where projects that use the C++ stdlib overlay stop building because of a linker error:
```
ld: Shared cache eligible dylib cannot link to ineligible dylib '@rpath/libswiftCompatibilitySpan.dylib'.
```

Usages of `Span<T>` would generally cause a type metadata accessor to be emitted for `Swift.Span`. This becomes a problem with backdeployment, since Span is partially defined in a compatibility binary.

This change adds `@_alwaysEmitIntoClient` to generic usages of `Span` to prevent the type metadata accessor from being emitted into `libswiftCxx.a`.

rdar://152192080
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jun 17, 2025
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

LGTM! Hopefully it fixes the problem we're seeing (and if not, it's a good change anyway)

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test macOS

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test Windows

1 similar comment
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test Windows

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test Windows

@egorzhdan egorzhdan merged commit e4fb254 into main Jun 19, 2025
4 of 5 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/span-shared-cache branch June 19, 2025 15:46
Xazax-hun pushed a commit that referenced this pull request Jun 24, 2025
The underlying issue was fixed in #82309

rdar://149402670
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants