Skip to content

🍒[Swift 5.10] Stop assuming CFSTR is a constant-time expression with Clang 15 #4953

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

Merged

Conversation

etcwilde
Copy link
Contributor

@etcwilde etcwilde commented May 11, 2024

From Clang 15, nested static initializer inside statement-expression is no longer a constant-time expression (See https://reviews.llvm.org/D127201). OSS Foundation defines CFSTR as a macro rather than __builtin___CFStringMakeConstantString and it uses nested static initializer inside statement-expression, so we can't assume CFSTR itself is always a constant-time expression.
This patch removes some static qualifiers associated with CFSTR to make them acceptable with Clang 15 and later.

…iftlang#4872)

From Clang 15, nested static initializer inside statement-expression is no
longer a constant-time expression (See https://reviews.llvm.org/D127201).
OSS Foundation defines `CFSTR` as a macro rather than
`__builtin___CFStringMakeConstantString` and it uses nested static
initializer inside statement-expression, so we can't assume `CFSTR` itself
is always a constant-time expression.
This patch removes some `static` qualifiers associated with `CFSTR` to
make them acceptable with Clang 15 and later.
@etcwilde etcwilde requested review from parkera and shahmishal May 11, 2024 23:14
@etcwilde etcwilde changed the title 🍒[Swift 5.10] Stop assuming CFSTR is a constant-time expression with Clang 15 (#4… 🍒[Swift 5.10] Stop assuming CFSTR is a constant-time expression with Clang 15 May 11, 2024
@etcwilde
Copy link
Contributor Author

@swift-ci please test

@etcwilde
Copy link
Contributor Author

We seem to be building and linking against a newer Swift stdlib than what we're trying to run the tests against.

$ "/Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-release/5.10/swift-corelibs-xctest/Tests/Functional/Asynchronous/Predicates/Handler/Output/Asynchronous-Predicates-Handler"
# command stderr:
dyld[81473]: Symbol not found: _swift_getTypeByMangledNameInContext2
  Referenced from: <9A3B36F4-AC33-3A8B-8557-5CFCFCB64DF3> /Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-release/5.10/swift-corelibs-xctest/Tests/Functional/Asynchronous/Predicates/Handler/Output/Asynchronous-Predicates-Handler (built for macOS 14.2 which is newer than running OS)
  Expected in:     <087DADAD-D590-35EA-AC4D-7B0E966804EB> /usr/lib/swift/libswiftCore.dylib

error: command failed with exit status: -6

@shahmishal shahmishal marked this pull request as ready for review May 15, 2024 07:54
@shahmishal shahmishal merged commit c66cb63 into swiftlang:release/5.10 May 15, 2024
2 of 3 checks passed
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