[PATCH] D12689: [libc++][static linking] std streams are not initialized prior to their use in static object constructors
Evgeny Astigeevich via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 09:19:04 PDT 2015
eastig added a comment.
In http://reviews.llvm.org/D12689#243295, @rnk wrote:
> I think a better approach would be to use `__attribute__((init_priority(101)))` on Linux and `#pragma init_seg(lib)` on Windows to ensure that libc++'s iostream initializer runs earlier.
Thank you for advice.
I found this discussion of init_priority: Clarification of attribute init_priority
https://gcc.gnu.org/ml/gcc-help/2011-05/msg00220.html
It looks like it is not reliable method (https://gcc.gnu.org/ml/gcc-help/2011-05/msg00221.html):
> Note that although the documentation doesn't seem to mention it, the
> init_priority attribute only works correctly when using the GNU linker
> or gold.
Gcc libc++ does not use it.
http://reviews.llvm.org/D12689
More information about the cfe-commits
mailing list