Skip to content
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

Cleanup native build warnings and unnecessary logos #91563

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Sep 4, 2023

The native build was producing a lot of warnings on Windows due to various compiler options overridings. It also prints logos for the resource compiler, assembler and c++ compiler when used for preprocessing.

This change cleans all of these. It introduces custom properties for the compiler options that were previously just overriden or manually removed from the options list. Now the properties enable setting the options like /guard:cf, /guard:ehcont or various /EHxxx per target / directory via these properties, so no overload of options occurs.

The native build was producing a lot of warnings on Windows due to
various compiler options overridings. It also prints logos for the
resource compiler, assembler and c++ compiler when used for
preprocessing.

This change cleans all of these. It introduces custom properties for the
compiler options that were previously just overriden on manually removed
from the options list. Now the properties enable setting the options
like /guard:cf, /guard:ehcont or various /EHxxx per target / directory
via these properties, so no overload of options occurs.
@janvorli janvorli added this to the 9.0.0 milestone Sep 4, 2023
@janvorli janvorli self-assigned this Sep 4, 2023
@ghost
Copy link

ghost commented Sep 4, 2023

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

The native build was producing a lot of warnings on Windows due to various compiler options overridings. It also prints logos for the resource compiler, assembler and c++ compiler when used for preprocessing.

This change cleans all of these. It introduces custom properties for the compiler options that were previously just overriden on manually removed from the options list. Now the properties enable setting the options like /guard:cf, /guard:ehcont or various /EHxxx per target / directory via these properties, so no overload of options occurs.

Author: janvorli
Assignees: janvorli
Labels:

area-Infrastructure-coreclr

Milestone: 9.0.0

@@ -54,7 +54,19 @@ add_compile_definitions("$<$<CONFIG:CHECKED>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDL
add_compile_definitions("$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:RELWITHDEBINFO>>:NDEBUG;URTBLDENV_FRIENDLY=Retail>")

if (MSVC)
add_linker_flag(/guard:cf)

define_property(TARGET PROPERTY CLR_CONTROL_FLOW_GUARD INHERITED BRIEF_DOCS "/guard:cf flag" FULL_DOCS "/guard:cf flag blablabla")
Copy link
Member

Choose a reason for hiding this comment

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

I never thought about doing this! This is quite clean. I'll probably use this technique more throughout the repo. Thanks for teaching me about it!

@janvorli
Copy link
Member Author

janvorli commented Sep 6, 2023

The failures are unrelated to the PR

@janvorli janvorli merged commit 41166b3 into dotnet:main Sep 6, 2023
@janvorli janvorli deleted the cleanup-build-warnings-and-logos-2 branch September 6, 2023 23:05
@jakobbotsch
Copy link
Member

@janvorli This PR has significantly altered MSVC's codegen of clrjit.dll. We currently see the following in our throughput measurements for PRs that compare a clrjit.dll from before this PR to one after:

image

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

@jakobbotsch That is strange, I was verifying the diff between compiler options and found them to be the same, just reordered. I will double check the jit ones though.
However, this change didn't touch anything Unix related, so I don't see how it could have influenced Linux and OSX. Are you sure the culprit is this change?

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

I've double checked the options for the JIT source files (diffing the generated compile_commands.json) for Windows and there is really no change.

@jakobbotsch
Copy link
Member

However, this change didn't touch anything Unix related, so I don't see how it could have influenced Linux and OSX. Are you sure the culprit is this change?

I'm quite sure -- I've narrowed it to this PR with a bisection. The above runs are all on Windows-x64 host but in some cases using crossjits. Indeed our native linux-x64 runs do not see these any TP differences.

I've double checked the options for the JIT source files (diffing the generated compile_commands.json) for Windows and there is really no change.

Is the size of clrjit.dll the same before and after? When I check, clrjit.dll is smaller after this change. I checked a few functions and in some cases it looks like there is less inlining -- did we maybe drop the link-time optimization options?

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

Hmm, I have actually not verified the linker options, so maybe I've missed something there. Let me check those too.

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

And neither the linker options differ.

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

Actually, let me try the release build. I was looking at debug build options.

@janvorli
Copy link
Member Author

janvorli commented Sep 7, 2023

Ok, found it. The release build is missing the /GL option (whole program optimization)

@ghost ghost locked as resolved and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants