[Bug libgcc/90399] split-stack + shared library + static object construction (C++)
ian at airs dot com
gcc-bugzilla@gcc.gnu.org
Sun May 26 23:19:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90399
Ian Lance Taylor <ian at airs dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-05-26
CC| |ian at airs dot com
Ever confirmed|0 |1
--- Comment #3 from Ian Lance Taylor <ian at airs dot com> ---
I do see a failure when I run the program. For me the error is happening when
running the global constructors. The global constructor Dummy::Dummy is
running before the main program's split-stack global constructor. Dummy::Dummy
is a global constructor in the shared library. It runs after the shared
library split-stack global constructor, but before the main program split-stack
global constructor. Unfortunately, it calls the main program
__splitstack_makecontext. That is because __splitstack_makecontext and friends
have default visibility rather than hidden; see the visibility attribute
settings near the top of libgcc/generic-morestack.c.
Basically, with the current implementation, a global constructor in a shared
library cannot call __splitstack_makecontext.
One possible fix might to use some sort of pthread_once call to let
__splitstack_makecontext, and possibly other functions with default visibility,
initialize static_pagesize and use_guard_page.
More information about the Gcc-bugs
mailing list