Skip to content

Use toolchain clang on macOS #74033

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
merged 2 commits into from
Jul 10, 2024

Conversation

etcwilde
Copy link
Member

Don't use the just-built clang on macOS. macOS does this more "right" than the Linux build. Linux will sometimes use the just-built Swift-driver with the just-built clang, but sometimes would use the system clang instead. macOS uses the toolchain Swift-driver with the toolchain clang. This is correct, but it means that if we force the other clang, we'll get mismatched sanitizer runtimes so the ASAN bot will fail.

rdar://128602427

@etcwilde etcwilde requested a review from hamishknight May 30, 2024 21:18
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde
Copy link
Member Author

preset=asan
@swift-ci please test with preset macOS platform

Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

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

Thanks!

@etcwilde
Copy link
Member Author

etcwilde commented Jul 8, 2024

preset=asan
@swift-ci please test with preset macOS platform

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

preset=asan
@swift-ci please test with preset Linux platform

@etcwilde etcwilde force-pushed the ewilde/all-the-configs-are-a-mess branch from ff501c8 to 72e37c2 Compare July 9, 2024 16:33
@etcwilde etcwilde requested a review from artemcm as a code owner July 9, 2024 16:33
@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

preset=asan
@swift-ci please test with preset macOS platform

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

preset=asan
@swift-ci please test with preset Linux platform

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

Ooohhh kay, so it appears that the combination of toolchain tools and just-built tools changes when building with ASAN vs not on Linux. 😭

Building normally
macOS: consistently uses the swiftc from the toolchain, so clang invocations and clang-linker invocations use the same
Linux: uses just-built swiftc which falls back on the toolchain clang for a bit, and then uses the just-built clang

Building with ASAN
both seem to use the swiftc from the toolchain instead of mixing just-built vs not.

etcwilde added 2 commits July 9, 2024 14:20
Don't use the just-built clang on macOS. macOS does this more "right"
than the Linux build. Linux will sometimes use the just-built
Swift-driver with the just-built clang, but sometimes would use the
system clang instead. macOS uses the toolchain Swift-driver with the
toolchain clang. This is correct, but it means that if we force the
other clang, we'll get mismatched sanitizer runtimes so the ASAN bot
will fail.
These two tests are exposing a use-after-free in the dependency scanner.
Disabling them for now so that I can fix the ASAN bots.

Disabled tests:
 - ScanDependencies/error_path.swift
 - ScanDependencies/error_source_locations.swift
@etcwilde etcwilde force-pushed the ewilde/all-the-configs-are-a-mess branch from 72e37c2 to a7432eb Compare July 9, 2024 21:21
@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

preset=asan
@swift-ci please test with preset macOS platform

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

preset=asan
@swift-ci please test with preset Linux platform

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

I'm a bit confused about how the Linux ASAN ever worked. libswiftCore.so and unittests/Threading/SwiftThreadingTests are being built with different clangs, which means it's going to pick up different compiler resource directories and have mismatched sanitizers. I think let's get macOS working for now so that we have ASAN working somewhere, and then can look into Linux with the upcoming build fix work.

swiftcore is built with /home/build-user/build/buildbot_incremental_asan/llvm-linux-x86_64/./bin/clang++, while the threading unittests are built with /opt/swift/5.8.1/usr/bin/clang++.

@etcwilde
Copy link
Member Author

etcwilde commented Jul 9, 2024

@swift-ci please test

@etcwilde etcwilde merged commit a89c5a0 into swiftlang:main Jul 10, 2024
6 of 7 checks passed
@etcwilde etcwilde deleted the ewilde/all-the-configs-are-a-mess branch November 6, 2024 04:57
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.

2 participants