[PATCH] D59273: [compiler-rt] Windows: fix crt_initializer.cc test uses wrong pragma to declare crt initializer.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 15:05:25 PDT 2019
rnk added a comment.
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.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59273/new/
https://reviews.llvm.org/D59273
More information about the llvm-commits
mailing list