Skip to content

build: emulate /GR- when compiling for Windows #14917

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 1 commit into from
Mar 2, 2018

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Mar 1, 2018

The /GR- emulation is needed to support building on Windows.
std::function in Microsoft's C++ runtime requires the use of typeid.
We do not want to emit RTTI data. -frtti -fno-rtti-data allows the
use of the typeid and dynamic_cast behaviours but will not emit the
RTTI data. With this change, it is possible to build the Windows
runtime once again.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

The /GR- emulation is needed to support building on Windows.
std::function in Microsoft's C++ runtime requires the use of `typeid`.
We do not want to emit RTTI data.  `-frtti -fno-rtti-data` allows the
use of the `typeid` and `dynamic_cast` behaviours but will not emit the
RTTI data.  With this change, it is possible to build the Windows
runtime once again.
@compnerd
Copy link
Member Author

compnerd commented Mar 1, 2018

@swift-ci please test and merge

@swift-ci swift-ci merged commit 204e517 into swiftlang:master Mar 2, 2018
@gottesmm
Copy link
Contributor

gottesmm commented Mar 2, 2018

@compnerd can you add a build system unittest that checks that we don't emit rtti? I would just copy what I did for the lto tests.

@compnerd compnerd deleted the fno-rtti-data branch March 2, 2018 01:38
@compnerd
Copy link
Member Author

compnerd commented Mar 2, 2018

@gottesmm mind pointing me to the commit so I can take a look at it and try to do something similar?

@gottesmm
Copy link
Contributor

gottesmm commented Mar 2, 2018

@compnerd no problem! Here it the commit:

ehttps://github.com/apple/swift/commit/95d926abb0e2e1cd9f5dab07802839e0d1ce5b41

And here is the file today:

https://github.com/apple/swift/tree/master/validation-test/BuildSystem/LTO
https://github.com/apple/swift/blob/master/validation-test/BuildSystem/LTO/host-libraries-do-have-bitcode.test-sh

@gottesmm
Copy link
Contributor

gottesmm commented Mar 2, 2018

Also, if it is difficult to do such a thing (i.e. there isn't a tool that does this out of the box, don't worry about it). But if we can... etc.

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