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

Don't /LTCG CRT initializers #2314

Merged
merged 1 commit into from
Nov 13, 2021

Conversation

CaseyCarter
Copy link
Member

@CaseyCarter CaseyCarter commented Nov 1, 2021

Fixes #2311

I verified the fix manually; open to suggestions for test coverage.

@CaseyCarter CaseyCarter added the build Related to the build system label Nov 1, 2021
@CaseyCarter CaseyCarter requested a review from a team as a code owner November 1, 2021 21:21
Copy link
Contributor

@AlexGuteniev AlexGuteniev left a comment

Choose a reason for hiding this comment

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

After TryAcquireSRWLockExclusive is impoerted statically due to Vista drop, the only way to observe the difference would be __crtGetSystemTimePreciseAsFileTime, which affects system_clock::now() granularity. I don't think we need a test for it.

@StephanTLavavej
Copy link
Member

I have manually verified the fix.

// cl /EHsc /nologo /W4 /MD /Zi /Fdmeow.pdb meow.cpp
#include <cstdio>
#include <mutex>
using namespace std;

int main() {
    mutex mut;
    puts("BEFORE");
    mut.lock();
    puts("DURING");
    mut.unlock();
    puts("AFTER");
}

Before this PR, stepping into mut.lock() eventually calls:

msvcp140_oss.dll!Concurrency::details::stl_critical_section_vista::lock()

After this PR, it calls:

msvcp140_oss.dll!Concurrency::details::stl_critical_section_win7::lock()

@StephanTLavavej StephanTLavavej self-assigned this Nov 12, 2021
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit f89fb6d into microsoft:main Nov 13, 2021
@StephanTLavavej
Copy link
Member

Thanks @AlexGuteniev for finding and @CaseyCarter for fixing this lurking bug! 🐞 🛠️ 😸

@CaseyCarter CaseyCarter deleted the dll_build_fix branch November 14, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STL: /MD version does not load dynamic imports
4 participants
  翻译: