fix breakage due to initializing thread pointer when loading libs
authorRich Felker <dalias@aerifal.cx>
Mon, 8 Oct 2012 00:19:11 +0000 (20:19 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 8 Oct 2012 00:19:11 +0000 (20:19 -0400)
at initial program load, all libraries must be loaded before the
thread pointer can be setup, since the TP-relative addresses of all
initial TLS objects must be constant.

src/ldso/dynlink.c

index 93cfb42..33ef7e5 100644 (file)
@@ -533,7 +533,7 @@ static struct dso *load_library(const char *name)
        /* Add a shortname only if name arg was not an explicit pathname. */
        if (pathname != name) p->shortname = strrchr(p->name, '/')+1;
        if (p->tls_image) {
-               if (!__pthread_self_init()) {
+               if (runtime && !__pthread_self_init()) {
                        free(p);
                        munmap(map, map_len);
                        return 0;