am a61ac525: Merge "Fix module constructor order."
* commit 'a61ac5257bea15d6cbfc640c03f18c2fb808b139': Fix module constructor order.
This commit is contained in:
commit
e135d7f305
@ -1276,6 +1276,15 @@ static void call_array(unsigned *ctor, int count, int reverse)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void soinfo_call_preinit_constructors(soinfo *si)
|
||||||
|
{
|
||||||
|
TRACE("[ %5d Calling preinit_array @ 0x%08x [%d] for '%s' ]\n",
|
||||||
|
pid, (unsigned)si->preinit_array, si->preinit_array_count,
|
||||||
|
si->name);
|
||||||
|
call_array(si->preinit_array, si->preinit_array_count, 0);
|
||||||
|
TRACE("[ %5d Done calling preinit_array for '%s' ]\n", pid, si->name);
|
||||||
|
}
|
||||||
|
|
||||||
void soinfo_call_constructors(soinfo *si)
|
void soinfo_call_constructors(soinfo *si)
|
||||||
{
|
{
|
||||||
if (si->constructors_called)
|
if (si->constructors_called)
|
||||||
@ -1294,18 +1303,10 @@ void soinfo_call_constructors(soinfo *si)
|
|||||||
// out above, the libc constructor will be called again (recursively!).
|
// out above, the libc constructor will be called again (recursively!).
|
||||||
si->constructors_called = 1;
|
si->constructors_called = 1;
|
||||||
|
|
||||||
if (si->flags & FLAG_EXE) {
|
if (!(si->flags & FLAG_EXE) && si->preinit_array) {
|
||||||
TRACE("[ %5d Calling preinit_array @ 0x%08x [%d] for '%s' ]\n",
|
|
||||||
pid, (unsigned)si->preinit_array, si->preinit_array_count,
|
|
||||||
si->name);
|
|
||||||
call_array(si->preinit_array, si->preinit_array_count, 0);
|
|
||||||
TRACE("[ %5d Done calling preinit_array for '%s' ]\n", pid, si->name);
|
|
||||||
} else {
|
|
||||||
if (si->preinit_array) {
|
|
||||||
DL_ERR("shared library \"%s\" has a preinit_array table @ 0x%08x. "
|
DL_ERR("shared library \"%s\" has a preinit_array table @ 0x%08x. "
|
||||||
"This is INVALID.", si->name, (unsigned) si->preinit_array);
|
"This is INVALID.", si->name, (unsigned) si->preinit_array);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (si->dynamic) {
|
if (si->dynamic) {
|
||||||
unsigned *d;
|
unsigned *d;
|
||||||
@ -1897,6 +1898,8 @@ sanitize:
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
soinfo_call_preinit_constructors(si);
|
||||||
|
|
||||||
for(i = 0; preloads[i] != NULL; i++) {
|
for(i = 0; preloads[i] != NULL; i++) {
|
||||||
soinfo_call_constructors(preloads[i]);
|
soinfo_call_constructors(preloads[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user