public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103133] New: Binary built with -static using std::thread crashes
@ 2021-11-08 12:02 loximann at gmail dot com
2021-11-08 12:17 ` [Bug libstdc++/103133] " redi at gcc dot gnu.org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: loximann at gmail dot com @ 2021-11-08 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Bug ID: 103133
Summary: Binary built with -static using std::thread crashes
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: loximann at gmail dot com
Target Milestone: ---
The following program crashes when built with -static on Fedora 35:
#include <thread>
int main(int argc, char *argv[])
{
std::thread foo{[](){}};
foo.join();
return 0;
}
Dynamic linking works fine though:
$ g++ f35_thread_static_broken.cpp
$ ./a.out
$ g++ -static f35_thread_static_broken.cpp
$ ./a.out
zsh: segmentation fault (core dumped) ./a.out
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
@ 2021-11-08 12:17 ` redi at gcc dot gnu.org
2021-11-08 12:31 ` fw at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-08 12:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-11-08
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The binary doesn't have a definition of pthread_join.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
2021-11-08 12:17 ` [Bug libstdc++/103133] " redi at gcc dot gnu.org
@ 2021-11-08 12:31 ` fw at gcc dot gnu.org
2021-11-08 12:47 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: fw at gcc dot gnu.org @ 2021-11-08 12:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Florian Weimer <fw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fw at gcc dot gnu.org
--- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> ---
libstdc++.a still uses weak symbols. I assumed we had already removed all that
weak symbol stuff from libstdc++ for __GLIBC_PREREQ (2, 34).
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
2021-11-08 12:17 ` [Bug libstdc++/103133] " redi at gcc dot gnu.org
2021-11-08 12:31 ` fw at gcc dot gnu.org
@ 2021-11-08 12:47 ` rguenth at gcc dot gnu.org
2021-11-08 12:50 ` redi at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-08 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Still a user error - you should link with -pthread
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (2 preceding siblings ...)
2021-11-08 12:47 ` rguenth at gcc dot gnu.org
@ 2021-11-08 12:50 ` redi at gcc dot gnu.org
2021-11-08 12:51 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-08 12:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> Still a user error - you should link with -pthread
That doesn't help here though.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (3 preceding siblings ...)
2021-11-08 12:50 ` redi at gcc dot gnu.org
@ 2021-11-08 12:51 ` redi at gcc dot gnu.org
2021-11-08 13:02 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-08 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #2)
> libstdc++.a still uses weak symbols. I assumed we had already removed all
> that weak symbol stuff from libstdc++ for __GLIBC_PREREQ (2, 34).
No, none of that work has even started yet.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (4 preceding siblings ...)
2021-11-08 12:51 ` redi at gcc dot gnu.org
@ 2021-11-08 13:02 ` redi at gcc dot gnu.org
2021-11-10 12:04 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-08 13:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Status|NEW |ASSIGNED
Target Milestone|--- |11.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (5 preceding siblings ...)
2021-11-08 13:02 ` redi at gcc dot gnu.org
@ 2021-11-10 12:04 ` cvs-commit at gcc dot gnu.org
2021-11-10 12:09 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-10 12:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:80fe172ba9820199c2bbce5d0611ffca27823049
commit r12-5108-g80fe172ba9820199c2bbce5d0611ffca27823049
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 9 23:45:36 2021 +0000
libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
Since Glibc 2.34 all pthreads symbols are defined directly in libc not
libpthread, and since Glibc 2.32 we have used __libc_single_threaded to
avoid unnecessary locking in single-threaded programs. This means there
is no reason to avoid linking to libpthread now, and so no reason to use
weak symbols defined in gthr-posix.h for all the pthread_xxx functions.
libstdc++-v3/ChangeLog:
PR libstdc++/100748
PR libstdc++/103133
* config/os/gnu-linux/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
Define for glibc 2.34 and later.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (6 preceding siblings ...)
2021-11-10 12:04 ` cvs-commit at gcc dot gnu.org
@ 2021-11-10 12:09 ` redi at gcc dot gnu.org
2021-11-12 10:28 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-10 12:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk, backports needed too.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (7 preceding siblings ...)
2021-11-10 12:09 ` redi at gcc dot gnu.org
@ 2021-11-12 10:28 ` redi at gcc dot gnu.org
2021-11-24 11:52 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-12 10:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For the record, musl does the same, since
g:85da5c3024f731e719c4093314da8edcd1056527
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (8 preceding siblings ...)
2021-11-12 10:28 ` redi at gcc dot gnu.org
@ 2021-11-24 11:52 ` cvs-commit at gcc dot gnu.org
2021-11-24 11:55 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-24 11:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:293075002a7eaf1e9d457a1839bcaf83f8626824
commit r11-9301-g293075002a7eaf1e9d457a1839bcaf83f8626824
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 9 23:45:36 2021 +0000
libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
Since Glibc 2.34 all pthreads symbols are defined directly in libc not
libpthread, and since Glibc 2.32 we have used __libc_single_threaded to
avoid unnecessary locking in single-threaded programs. This means there
is no reason to avoid linking to libpthread now, and so no reason to use
weak symbols defined in gthr-posix.h for all the pthread_xxx functions.
libstdc++-v3/ChangeLog:
PR libstdc++/100748
PR libstdc++/103133
* config/os/gnu-linux/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
Define for glibc 2.34 and later.
(cherry picked from commit 80fe172ba9820199c2bbce5d0611ffca27823049)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (9 preceding siblings ...)
2021-11-24 11:52 ` cvs-commit at gcc dot gnu.org
@ 2021-11-24 11:55 ` redi at gcc dot gnu.org
2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
2022-08-03 13:33 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-24 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 11.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (10 preceding siblings ...)
2021-11-24 11:55 ` redi at gcc dot gnu.org
@ 2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
2022-08-03 13:33 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-03 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:18eecb8c4a97716d4bc4890b05c91f172fadc7b3
commit r10-10928-g18eecb8c4a97716d4bc4890b05c91f172fadc7b3
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 9 23:45:36 2021 +0000
libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
Since Glibc 2.34 all pthreads symbols are defined directly in libc not
libpthread, and since Glibc 2.32 we have used __libc_single_threaded to
avoid unnecessary locking in single-threaded programs. This means there
is no reason to avoid linking to libpthread now, and so no reason to use
weak symbols defined in gthr-posix.h for all the pthread_xxx functions.
libstdc++-v3/ChangeLog:
PR libstdc++/100748
PR libstdc++/103133
* config/os/gnu-linux/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
Define for glibc 2.34 and later.
(cherry picked from commit 80fe172ba9820199c2bbce5d0611ffca27823049)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/103133] Binary built with -static using std::thread crashes
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
` (11 preceding siblings ...)
2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
@ 2022-08-03 13:33 ` redi at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-03 13:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103133
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.3 |10.5
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Also fixed for 10.5
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-08-03 13:33 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 12:02 [Bug c++/103133] New: Binary built with -static using std::thread crashes loximann at gmail dot com
2021-11-08 12:17 ` [Bug libstdc++/103133] " redi at gcc dot gnu.org
2021-11-08 12:31 ` fw at gcc dot gnu.org
2021-11-08 12:47 ` rguenth at gcc dot gnu.org
2021-11-08 12:50 ` redi at gcc dot gnu.org
2021-11-08 12:51 ` redi at gcc dot gnu.org
2021-11-08 13:02 ` redi at gcc dot gnu.org
2021-11-10 12:04 ` cvs-commit at gcc dot gnu.org
2021-11-10 12:09 ` redi at gcc dot gnu.org
2021-11-12 10:28 ` redi at gcc dot gnu.org
2021-11-24 11:52 ` cvs-commit at gcc dot gnu.org
2021-11-24 11:55 ` redi at gcc dot gnu.org
2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
2022-08-03 13:33 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).