https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127286
Bug ID: 127286
Summary: libssp/ssp.c __guard_setup constructor should have a
priority
Product: gcc
Version: 16.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: timo at rothenpieler dot org
Target Milestone: ---
I encountered this while trying to link with a static libgio from glib.
On Windows, libgio has a constructor which starts a background thread, and that
constructor, also declared without a priority, wins against the one in libssp.
The result of that is that at some random point during that background threads
runtime, __stack_chk_guard gets set, and whatever function is currently being
executed on the thread then crashes on return.
The __guard_setup() constructor should probably be declared with priority 0,
given that every other constructor might be relying on SSP itself?
It just won't result in a crash unless they do as libgio does, and start a new
thread.