previous test used #pragma data_seg(".CRT.....") to allocate a user defines initializer in the .crt$ segment. A small bug, the correct way to declare this is with init_seg rather than data_seg.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
No objection from the mingw perspective. Sanitizers on mingw are only supported by clang+lld, not by gcc/ld.bfd, and then it's built by clang in mingw mode with -fms-extensions, so most msvc specific extensions are available. Additionally, I haven't even yet a full setup for running compiler-rt/libcxx runtime tests, so I'm not sure if there are other things that need to be fixed wrt mingw in the tests.
I don't think this change is correct, the test is creating a global variable, run_on_startup, and allocating it into .CRT$XIB. There are no initializers involved, which is what #pragma init_seg controls. We'd have to restructure the test like so for that to make sense:
#pragma init_seg(".crt$XIB") struct AutoIniti { AutoInit() { call_me_maybe(); } } run_on_startup;
This test is essentially rolling its own initializer, so data_seg is the right pragma. Another way to do this would be to use #pragma section / __declspec(allocate).
When I apply your patch locally and compile the test with clang-cl, I see that no .CRT$XIB section is present in the object file.
Yep! 100% I made a mistake, the test should remain the same. I'm going to abandon this revision. Thank you for your quick review!