Skip to content

[stdlib] Export ActiveTask symbol - #91067

Open
felipepiovezan wants to merge 1 commit into
swiftlang:mainfrom
felipepiovezan:felipe/active_task_export
Open

[stdlib] Export ActiveTask symbol#91067
felipepiovezan wants to merge 1 commit into
swiftlang:mainfrom
felipepiovezan:felipe/active_task_export

Conversation

@felipepiovezan

@felipepiovezan felipepiovezan commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The debugger needs to access this variable when the concurrency library
is compiled with ThreadLocalStorage enabled (Linux, Windows). Mangled
names on anonymous namespaces are not reliable, and a file-scope local
would not survive stripping the concurrency library of symbols (.symtab
does not survive, whereas .dynsym does). In those platforms, this
patch gives it protected visibility and a stable name.

A consequence is that the variable is renamed and moved outside the
helper class on all platforms, since extern C and class statics are
not compatible. This mostly cosmetic, with a very minor effect on
encapsulation.

On Windows, thread local + SWIFT_ATTRIBUTE_FOR_EXPORTS (dllexport) is
not a valid combination. So we only give it a stable name, but this
should suffice on that platform.

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@adrian-prantl

Copy link
Copy Markdown
Contributor

+1, I think it is a better design to make the contract between LLDB and the runtime more explicit.

@felipepiovezan

felipepiovezan commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

On macOS:

lldb-api :: lang/swift/embedded/nested_type_alias/TestSwiftEmbeddedNestedTypeAlias.py

Likely unrelated

Linux LLDB failures are expected, this needs to be tested with the matching LLDB PR.
Windows failures are real: it isn't too happy with the export.

@ktoso ktoso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems fine to me, lldb relies on this already if I understand correctly?

@felipepiovezan
felipepiovezan force-pushed the felipe/active_task_export branch from ffed010 to 41ceb71 Compare July 30, 2026 07:48
The debugger needs to access this variable when the concurrency library
is compiled with ThreadLocalStorage enabled (Linux, Windows). Mangled
names on anonymous namespaces are not reliable, and a file-scope local
would not survive stripping the concurrency library of symbols (.symtab
does not survive, whereas .dynsym does). In those platforms, this
patch gives it protected visibility and a stable name.

A consequence is that the variable is renamed _and_ moved outside the
helper class on all platforms, since `extern C` and class statics are
not compatible. This mostly cosmetic, with a very minor effect on
encapsulation.

On Windows, thread local + SWIFT_ATTRIBUTE_FOR_EXPORTS (dllexport) is
not a valid combination. So we only give it a stable name, but this
should suffice on that platform.
@felipepiovezan
felipepiovezan force-pushed the felipe/active_task_export branch from 41ceb71 to 6813078 Compare July 30, 2026 07:49
@felipepiovezan

Copy link
Copy Markdown
Contributor Author

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

This seems fine to me, lldb relies on this already if I understand correctly?

Yup! This PR is just making sure we have a sound way of finding the symbol across all platforms/runtime implementations

@felipepiovezan

Copy link
Copy Markdown
Contributor Author
10:11:38  Cannot contact macos-node-i-09bcc0b1c33539921: java.io.IOException: cannot find current thread
10:17:05  Cancelling nested steps due to timeout
10:17:05  Sending interrupt signal to process

😞

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

swiftlang/llvm-project#13577

@swift-ci test macos platform

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

windows:

[997/1341] Testing SourceKitLSPTests.RenameTests/testRemoveLabel
Error: Error: swift exited with code -1073741819.

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

swiftlang/llvm-project#13577

@swift-ci test windows platform

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