Skip to content

[Frontend] Turn symbols-missing-from-TBD validation on by default in debug builds on Apple platforms. #16838

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
Jun 28, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented May 25, 2018

TBD validation is effectively an expensive assertion, and is currently only
tuned for Apple platforms. However, we don't want it to regress more, and it
would be nice to start getting validation from people using master
snapshots. Together, this means that turning it on by default for the cases
mentioned above is an appropriate course of action.

At the very least, this has the benefit of running validation across the stdlib,
the overlays and the whole testsuite on each build, so people making changes to
the compiler that change symbols are hopefully alerted.

One limitation here is that this is only validating that the TBD is a superset
of the true set of symbols: it could include spurious symbols that aren't
actually in the binary. This case is less problematic for Swift than symbols
missing from the TBD file, and so we've focused energy on this. Once we've fixed
the extra-symbols problems and are confident in it, this validation can be
upgraded to validate that too.

Half of rdar://problem/40431434.

(This PR currently includes #16837, but that should land earlier, since I want to test this a little more extensively.)

@huonw
Copy link
Contributor Author

huonw commented May 25, 2018

@swift-ci please test

@huonw
Copy link
Contributor Author

huonw commented May 30, 2018

@swift-ci please test source compatibility

@huonw
Copy link
Contributor Author

huonw commented Jun 2, 2018

I believe #16959 fixes the last of the source compat failures.

@huonw
Copy link
Contributor Author

huonw commented Jun 26, 2018

@swift-ci please test source compatibility

2 similar comments
@huonw
Copy link
Contributor Author

huonw commented Jun 27, 2018

@swift-ci please test source compatibility

@huonw
Copy link
Contributor Author

huonw commented Jun 27, 2018

@swift-ci please test source compatibility

@huonw
Copy link
Contributor Author

huonw commented Jun 27, 2018

@swift-ci please smoke test

@@ -246,7 +246,13 @@ class FrontendOptions {
};

/// Compare the symbols in the IR against the TBD file we would generate.
TBDValidationMode ValidateTBDAgainstIR = TBDValidationMode::None;
TBDValidationMode ValidateTBDAgainstIR =
#if !defined(NDEBUG) && defined(__APPLE__)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a target check instead, in case someone builds a cross-compiler on macOS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't tell if this was a target or host check, and if it wasn't, couldn't work out the target check. Tips?

Copy link
Contributor

Choose a reason for hiding this comment

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

Target checks are always performed at run time, and since the target isn't stored in FrontendOptions itself you'd have to do it at a bit higher level. There's not a super clean way to do this in the argument parsing in the frontend, though, because frontend options are processed first, before even the -target option. (Check out CompilerInvocation::parseArgs.)

One way to deal with this could be to make the field Optional, and then fall back at the use site based on the target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, of course.

…debug builds on Apple platforms.

TBD validation is effectively an expensive assertion, and is currently only
tuned for Apple platforms. However, we don't want it to regress more, and it
would be nice to start getting validation from people using master
snapshots. Together, this means that turning it on by default for the cases
mentioned above is an appropriate course of action.

At the very least, this has the benefit of running validation across the stdlib,
the overlays and the whole testsuite on each build, so people making changes to
the compiler that change symbols are hopefully alerted.

One limitation here is that this is only validating that the TBD is a superset
of the true set of symbols: it could include spurious symbols that aren't
actually in the binary. This case is less problematic for Swift than symbols
missing from the TBD file, and so we've focused energy on this. Once we've fixed
the extra-symbols problems and are confident in it, this validation can be
upgraded to validate that too.

Half of rdar://problem/40431434.
@huonw huonw force-pushed the validate-tbd-by-default branch from 2c2b88a to caa3dd4 Compare June 28, 2018 00:35
@huonw
Copy link
Contributor Author

huonw commented Jun 28, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 2c2b88a9df355cb60e0e35c6c5a17f9ab7b1237b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2c2b88a9df355cb60e0e35c6c5a17f9ab7b1237b

@huonw
Copy link
Contributor Author

huonw commented Jun 28, 2018

@swift-ci please test

@huonw
Copy link
Contributor Author

huonw commented Jun 28, 2018

@swift-ci please test source compatibility

@huonw huonw merged commit 0c4fe6c into swiftlang:master Jun 28, 2018
@huonw huonw deleted the validate-tbd-by-default branch June 28, 2018 04:11
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