about summary refs log tree commit diff
path: root/src/ldso/dynlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ldso/dynlink.c')
-rw-r--r--src/ldso/dynlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index d1974736..ac4b669f 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -692,6 +692,10 @@ static void do_init_fini(struct dso *p)
 		}
 		if (dyn[0] & (1<<DT_INIT))
 			((void (*)(void))(p->base + dyn[DT_INIT]))();
+		if (!need_locking && libc.threads_minus_1) {
+			need_locking = 1;
+			pthread_mutex_lock(&init_fini_lock);
+		}
 	}
 	if (need_locking) pthread_mutex_unlock(&init_fini_lock);
 }