1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

Reference an external variable in threaded programs so that the

autoinitialiser gets linked in and therefore called before main().
This commit is contained in:
John Birrell 1998-04-29 09:08:43 +00:00
parent 7317e6b1fd
commit 96c76d66db
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35502

View File

@ -60,6 +60,12 @@ exit(status)
register struct atexit *p;
register int n;
#ifdef _THREAD_SAFE
extern int _thread_autoinit_dummy_decl;
/* Ensure that the auto-initialization routine is linked in: */
_thread_autoinit_dummy_decl = 1;
#endif
for (p = __atexit; p; p = p->next)
for (n = p->ind; --n >= 0;)
(*p->fns[n])();