-
Notifications
You must be signed in to change notification settings - Fork 14
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
libstdc++ must use thread-local errno #45
Comments
Looking a bit closer to demonstrate the use of the gcc/libstdc++-v3/src/c++17/fs_ops.cc Lines 1479 to 1483 in aa6086b
And then in the disassembly on an OmniOS r151038c machine:
Note that after the call to
On a machine where we passed
|
See also: 13842 thread-local errno is all you need |
It would seem that
libstdc++.so.0.6.28
does not end up built with-D_TS_ERRNO
defined (e.g., via-D_REENTRANT
). This results inerrno
checks in, for example,std::filesystem::status()
looking at the globalerrno
rather than using*___errno()
as it should to local the thread-specific error number.This was noticed when trying to use Clickhouse, a large C++ program that makes heavy use of threads. The
std::filesystem::exists()
call would throw unexpectedly for files or directories that did not exist -- but it would report "Error 0" as the reason.It's possible to pass
-D_TS_ERRNO
in viaCFLAGS
andCXXFLAGS
while building GCC -- but I expect we should enable this by default and always in the source itself, in order to ensure correct binaries are always created.The text was updated successfully, but these errors were encountered: