diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-05-20 15:40:35 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-07-06 11:15:58 +0200 |
commit | 706ad1e7af37be1d25fc2359bda006d31fe0d11b (patch) | |
tree | d06e6a96c1d319a1d27fa6b6e87cfadf8bd6ef08 /elf/Makefile | |
parent | 8f4632deb3545b2949cec5454afc3cb21a0024ea (diff) | |
download | glibc-706ad1e7af37be1d25fc2359bda006d31fe0d11b.tar.gz glibc-706ad1e7af37be1d25fc2359bda006d31fe0d11b.tar.xz glibc-706ad1e7af37be1d25fc2359bda006d31fe0d11b.zip |
Add the __libc_single_threaded variable
The variable is placed in libc.so, and it can be true only in an outer libc, not libcs loaded via dlmopen or static dlopen. Since thread creation from inner namespaces does not work, pthread_create can update __libc_single_threaded directly. Using __libc_early_init and its initial flag, implementation of this variable is very straightforward. A future version may reset the flag during fork (but not in an inner namespace), or after joining all threads except one. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'elf/Makefile')
-rw-r--r-- | elf/Makefile | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/elf/Makefile b/elf/Makefile index 6fe1df90bb..81a696c3ef 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -155,7 +155,9 @@ endif tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \ tst-dl-iter-static \ tst-tlsalign-static tst-tlsalign-extern-static \ - tst-linkall-static tst-env-setuid tst-env-setuid-tunables + tst-linkall-static tst-env-setuid tst-env-setuid-tunables \ + tst-single_threaded-static tst-single_threaded-pthread-static + tests-static-internal := tst-tls1-static tst-tls2-static \ tst-ptrguard1-static tst-stackguard1-static \ tst-tls1-static-non-pie tst-libc_dlvsym-static @@ -174,9 +176,11 @@ tests-internal := tst-tls1 tst-tls2 $(tests-static-internal) tests-static := $(tests-static-normal) $(tests-static-internal) ifeq (yes,$(build-shared)) -tests-static += tst-tls9-static -tst-tls9-static-ENV = \ - LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn +tests-static += tst-tls9-static tst-single_threaded-static-dlopen +static-dlopen-environment = \ + LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn +tst-tls9-static-ENV = $(static-dlopen-environment) +tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment) tests += restest1 preloadtest loadfail multiload origtest resolvfail \ constload1 order noload filter \ @@ -204,7 +208,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \ tst-dlopenfail-2 \ tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \ - tst-audit14 tst-audit15 tst-audit16 + tst-audit14 tst-audit15 tst-audit16 \ + tst-single_threaded tst-single_threaded-pthread # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -317,7 +322,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \ tst-dlopenfailmod3 tst-ldconfig-ld-mod \ tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee \ - tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 + tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 \ + tst-single_threaded-mod1 tst-single_threaded-mod2 \ + tst-single_threaded-mod3 tst-single_threaded-mod4 # Most modules build with _ISOMAC defined, but those filtered out # depend on internal headers. modules-names-tests = $(filter-out ifuncmod% tst-libc_dlvsym-dso tst-tlsmod%,\ @@ -1748,3 +1755,17 @@ $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so $(objpfx)tst-auxobj-dlopen: $(libdl) $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so + +$(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so $(libdl) +$(objpfx)tst-single_threaded.out: \ + $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so +$(objpfx)tst-single_threaded-static-dlopen: \ + $(objpfx)tst-single_threaded-mod1.o $(common-objpfx)dlfcn/libdl.a +$(objpfx)tst-single_threaded-static-dlopen.out: \ + $(objpfx)tst-single_threaded-mod2.so +$(objpfx)tst-single_threaded-pthread: \ + $(objpfx)tst-single_threaded-mod1.so $(libdl) $(shared-thread-library) +$(objpfx)tst-single_threaded-pthread.out: \ + $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \ + $(objpfx)tst-single_threaded-mod4.so +$(objpfx)tst-single_threaded-pthread-static: $(static-thread-library) |