-
Notifications
You must be signed in to change notification settings - Fork 177
Disable LLVM ABI breaking checks by default when building swift #45
base: swift-4.0-branch
Are you sure you want to change the base?
Disable LLVM ABI breaking checks by default when building swift #45
Conversation
The LLVM ABI breaking checks require that all uses of llvm's ADT library must also link libSupport. Parts of the Swift standard library use ADT without Support intentionally. To make this work we must disable the ABI breaking checks when building swift. This patch changes the default value of the option that controls the ABI breaking checks to disable the checks by default if the swift source directory is present in the LLVM build tree.
@swift-ci please test |
This should be going to master, not swift-4.0-branch. |
@jrose-apple it is an LLVM change. There is no master. My thought was to put it in swift-4.0 (which merges to stable), then upstream-with-swift. Is there a reason to leave it out of 4.0? |
Oops, sorry, I thought it was a Swift change. Usually we would put something in upstream-with-swift first and then cherry-pick down, just like Clang changes usually go into trunk before they're cherry-picked. However, why turn this off by default? Why not just turn it off for swiftRuntime? |
The setting gets baked into an LLVM configuration-driven header that is included by the ADT headers. It has to be off in the configuration of LLVM in order for it to be off, you can't just override it for a subdirectory. We currently disable it in build-script-impl when building LLVM. |
:-/ All right. That doesn't seem like a good long-term answer to me, but I'm not going to put myself into the discussion for now. |
@swift-ci please smoke test |
@swift-ci please test |
Do you need to change LLVM? @bob-wilson had added a way for client to include ADT without getting check inject, why isn't it enough on the swift side? |
As far as I can tell, Swift disables the checks when building LLVM, and that is how it gets around the problem. All this patch does is default the value to off if you are building Swift, so that running CMake with no options produces build files that will actually build successfully. |
The files in Swift that include ADT needs to have this defined on the command line: |
@joker-eph The Swift workaround @bob-wilson made is here: https://github.com/apple/swift/blob/6c1eec81c44400fd4cefb5d7df32b861a3e6a066/utils/build-script-impl#L728 From this patch: This patch allows you to put Swift under LLVM/tools, and run "cmake && ninja" and get a swift compiler and standard library. Without this patch the standard library build will fail. |
To clarify, when I wrote |
The LLVM change to make this possible was: https://reviews.llvm.org/D29919 "allow migrating away from cmake option for LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING" |
Ah. That patch is newer than this PR. This PR has been around for over a month, but PR testing was broken when I first tried to land it. |
I already put my LLVM change r295090 into swift-4.0-branch (22f170f). I have been holding the Swift side of the change for a few weeks to minimize the impact on Swift developers, giving more time for people to rebuild their copy of LLVM (swiftlang/swift#7469). I suppose it has been long enough. I'll plan to do that tomorrow. |
The LLVM ABI breaking checks require that all uses of llvm's ADT library must also link libSupport. Parts of the Swift standard library use ADT without Support intentionally. To make this work we must disable the ABI breaking checks when building swift.
This patch changes the default value of the option that controls the ABI breaking checks to disable the checks by default if the swift source directory is present in the LLVM build tree.
Currently disabling these checks is handled by the swift build-script, but to support non-build-script builds having the default work is ideal.