Frontend: Fix -target-variant subarch normalization - #78413
Conversation
In swiftlang#77156, normalization was introduced for -target-variant triples. That PR also caused -target-variant arguments to be inherited from the main compilation options whenever building dependency modules from their interfaces, which is incorrect. The -target-variant option must only be specified when compiling a "zippered" module, but the dependencies of zippered modules are not necessarily zippered themselves and indiscriminantly propagating the option can cause miscompilation. The new, more targeted approach to normalizing arm64e triples simply uses the arch and subarch of the -target argument of the main compile to decide whether the subarch of both the -target and -target-variant arguments of a dependency need adjustment. Resolves rdar://135322077 and rdar://141640919.
|
@swift-ci please test |
|
@swift-ci please build toolchain macOS |
nkcsgexi
left a comment
There was a problem hiding this comment.
Thank you for addressing the root cause Allan!
|
Thanks for the fix, Allan, and sorry for the breakage. One thing I noticed while working on the original problem is that most of the macCatalyst tests do not run in swift.org open source CI and it is quite easy to break them, and some of them are broken already (the ones in this PR should run because they do not require macCatalyst at all). I tried providing a preset in #77386 and fix some of the tests in #77506 (which partial success). I hope Apple has some kind of testing for those internally, but can we have a look at least to having a preset so we can test in the open source CI (and maybe fix those broken tests)?. |
|
I don't think this breakage would have been caught by a macCatalyst preset because we didn't have coverage for this issue, even in the tests with |
In #77156, normalization was introduced for
-target-varianttriples. That PR also caused-target-variantarguments to be inherited from the main compilation options whenever building dependency modules from their interfaces, which is incorrect. The-target-variantoption must only be specified when compiling a "zippered" module, but the dependencies of zippered modules are not necessarily zippered themselves and indiscriminately propagating the option can cause miscompilation.The new, more targeted approach to normalizing arm64e triples simply uses the arch and subarch of the
-targetargument of the main compile to decide whether the subarch of both the-targetand-target-variantarguments of a dependency need adjustment.Resolves rdar://135322077 and rdar://141640919.