Parcourir la source

fix crashes in static-linked multithreaded programs without TLS

Rich Felker il y a 12 ans
Parent
commit
ebee8c2b47
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      src/env/__init_tls.c

+ 2 - 0
src/env/__init_tls.c

@@ -60,6 +60,8 @@ void __init_tls(size_t *aux)
 	Phdr *phdr, *tls_phdr=0;
 	size_t base = 0;
 
+	libc.tls_size = sizeof(struct pthread);
+
 	for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
 		phdr = (void *)p;
 		if (phdr->p_type == PT_PHDR)