public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts
@ 2024-02-12 17:09 stffn.mobil at freenet dot de
  2024-02-12 17:12 ` [Bug other/113891] " stffn.mobil at freenet dot de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: stffn.mobil at freenet dot de @ 2024-02-12 17:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113891

            Bug ID: 113891
           Summary: On FreeBSD, a statically linked program which runs a
                    std::thread aborts
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stffn.mobil at freenet dot de
  Target Milestone: ---

Created attachment 57400
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57400&action=edit
g++13 -v

A simple program which launches a std::thread and is statically linked on
FreeBSD aborts. This is not an issue with dynamically linked program. This is
also not an issue with LLVM.

The gdb backtrace points to the function thread_start in FreeBSD's libthr
(thr_create.c). So I thought this would be an issue with the pthread
implementation but I sadly can't reproduce this with a C program.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/113891] On FreeBSD, a statically linked program which runs a std::thread aborts
  2024-02-12 17:09 [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts stffn.mobil at freenet dot de
@ 2024-02-12 17:12 ` stffn.mobil at freenet dot de
  2024-02-12 17:13 ` stffn.mobil at freenet dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: stffn.mobil at freenet dot de @ 2024-02-12 17:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113891

--- Comment #1 from Steffen <stffn.mobil at freenet dot de> ---
Created attachment 57401
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57401&action=edit
main.ii

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/113891] On FreeBSD, a statically linked program which runs a std::thread aborts
  2024-02-12 17:09 [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts stffn.mobil at freenet dot de
  2024-02-12 17:12 ` [Bug other/113891] " stffn.mobil at freenet dot de
@ 2024-02-12 17:13 ` stffn.mobil at freenet dot de
  2024-02-12 17:17 ` [Bug target/113891] " pinskia at gcc dot gnu.org
  2024-02-13 10:44 ` stffn.mobil at freenet dot de
  3 siblings, 0 replies; 5+ messages in thread
From: stffn.mobil at freenet dot de @ 2024-02-12 17:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113891

--- Comment #2 from Steffen <stffn.mobil at freenet dot de> ---
The program was compiled with g++13 -pthread -static main.cc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113891] On FreeBSD, a statically linked program which runs a std::thread aborts
  2024-02-12 17:09 [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts stffn.mobil at freenet dot de
  2024-02-12 17:12 ` [Bug other/113891] " stffn.mobil at freenet dot de
  2024-02-12 17:13 ` stffn.mobil at freenet dot de
@ 2024-02-12 17:17 ` pinskia at gcc dot gnu.org
  2024-02-13 10:44 ` stffn.mobil at freenet dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-12 17:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113891

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect this is due to the use of weak for pthread functions.

Most likely you need to force include all of libthr archive file.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113891] On FreeBSD, a statically linked program which runs a std::thread aborts
  2024-02-12 17:09 [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts stffn.mobil at freenet dot de
                   ` (2 preceding siblings ...)
  2024-02-12 17:17 ` [Bug target/113891] " pinskia at gcc dot gnu.org
@ 2024-02-13 10:44 ` stffn.mobil at freenet dot de
  3 siblings, 0 replies; 5+ messages in thread
From: stffn.mobil at freenet dot de @ 2024-02-13 10:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113891

--- Comment #4 from Steffen <stffn.mobil at freenet dot de> ---
I'm not sure how to get this done.
I tried it with -Wl,--no-as-needed, which aborts as well and
-Wl,--whole-archive but that does not compile with undefined reference errors

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-13 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 17:09 [Bug other/113891] New: On FreeBSD, a statically linked program which runs a std::thread aborts stffn.mobil at freenet dot de
2024-02-12 17:12 ` [Bug other/113891] " stffn.mobil at freenet dot de
2024-02-12 17:13 ` stffn.mobil at freenet dot de
2024-02-12 17:17 ` [Bug target/113891] " pinskia at gcc dot gnu.org
2024-02-13 10:44 ` stffn.mobil at freenet dot de

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).