lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # uClibc TLS tests |
| 2 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 3 | |
| 4 | TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 \ |
| 5 | tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13 \ |
| 6 | tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \ |
| 7 | tst-tls1-static tst-tls2-static tst-tls9-static |
| 8 | TESTS_DISABLED := tst-tls1-static tst-tls2-static tst-tls9-static |
| 9 | |
| 10 | #all these tests require shared libraries |
| 11 | ifeq ($(HAVE_SHARED),) |
| 12 | TESTS_DISABLED := $(TESTS) |
| 13 | endif |
| 14 | |
| 15 | # All these tests need tls.h, which is not installed with glibc |
| 16 | GLIBC_TESTS_DISABLED := $(addsuffix _glibc,$(filter-out $(TESTS_DISABLED),$(TESTS))) |
| 17 | |
| 18 | |
| 19 | |
| 20 | PTDIR := $(top_builddir)libpthread/nptl |
| 21 | SYSDEPS_DIR := $(top_srcdir)libc/sysdeps |
| 22 | |
| 23 | EXTRA_CFLAGS := -DNOT_IN_libc=1 \ |
| 24 | -std=gnu99 -I. \ |
| 25 | -I$(SYSDEPS_DIR)/linux \ |
| 26 | -I$(SYSDEPS_DIR)/linux/$(TARGET_ARCH) \ |
| 27 | -I$(PTDIR) \ |
| 28 | -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \ |
| 29 | -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \ |
| 30 | -I$(PTDIR)/sysdeps/unix/sysv/linux \ |
| 31 | -I$(PTDIR)/sysdeps/pthread \ |
| 32 | -I$(PTDIR)/sysdeps/pthread/bits \ |
| 33 | -I$(PTDIR)/sysdeps/generic \ |
| 34 | -I$(top_builddir)ldso/include \ |
| 35 | -I$(top_builddir)ldso/ldso/$(TARGET_ARCH) \ |
| 36 | -I$(top_builddir)include \ |
| 37 | -include $(top_builddir)include/libc-symbols.h |
| 38 | |
| 39 | tlsmod17a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
| 40 | tlsmod18a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
| 41 | CFLAGS_tst-tlsmod1.so := -fPIC -DSHARED -shared |
| 42 | CFLAGS_tst-tlsmod2.so := -fPIC -DSHARED -shared |
| 43 | CFLAGS_tst-tlsmod3.so := -fPIC -DSHARED -shared |
| 44 | CFLAGS_tst-tlsmod4.so := -fPIC -DSHARED -shared |
| 45 | CFLAGS_tst-tlsmod5.so := -fPIC -DSHARED -shared |
| 46 | CFLAGS_tst-tlsmod6.so := -fPIC -DSHARED -shared |
| 47 | CFLAGS_tst-tlsmod7.so := -fPIC -DSHARED -shared |
| 48 | CFLAGS_tst-tlsmod8.so := -fPIC -DSHARED -shared |
| 49 | CFLAGS_tst-tlsmod9.so := -fPIC -DSHARED -shared |
| 50 | CFLAGS_tst-tlsmod10.so := -fPIC -DSHARED -shared |
| 51 | CFLAGS_tst-tlsmod11.so := -fPIC -DSHARED -shared |
| 52 | CFLAGS_tst-tlsmod12.so := -fPIC -DSHARED -shared |
| 53 | CFLAGS_tst-tlsmod13.so := -fPIC -DSHARED -shared |
| 54 | CFLAGS_tst-tlsmod13a.so := -fPIC -DSHARED -shared |
| 55 | CFLAGS_tst-tlsmod14a.so := -fPIC -DSHARED -shared |
| 56 | CFLAGS_tst-tlsmod14b.so := -fPIC -DSHARED -shared |
| 57 | CFLAGS_tst-tlsmod15a.so := -fPIC -DSHARED -shared |
| 58 | CFLAGS_tst-tlsmod15b.so := -fPIC -DSHARED -shared |
| 59 | CFLAGS_tst-tlsmod16a.so := -fPIC -DSHARED -shared |
| 60 | CFLAGS_tst-tlsmod16b.so := -fPIC -DSHARED -shared |
| 61 | CFLAGS_tst-tlsmod17a.so := -fPIC -DSHARED -shared |
| 62 | CFLAGS_tst-tlsmod17b.so := -fPIC -DSHARED -shared |
| 63 | CFLAGS_tst-tlsmod18a.so := -fPIC -DSHARED -shared |
| 64 | CFLAGS_tst-tlsmod-at-ctor.so := -fPIC -DSHARED -shared |
| 65 | |
| 66 | LDFLAGS_tst-tlsmod1.so := -shared -static-libgcc -L$(top_builddir)lib |
| 67 | LDFLAGS_tst-tlsmod2.so := -shared -static-libgcc -L$(top_builddir)lib |
| 68 | LDFLAGS_tst-tlsmod3.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 69 | tst-tlsmod2.so |
| 70 | LDFLAGS_tst-tlsmod4.so := -shared -static-libgcc -L$(top_builddir)lib |
| 71 | LDFLAGS_tst-tlsmod5.so := -shared -static-libgcc -L$(top_builddir)lib |
| 72 | LDFLAGS_tst-tlsmod6.so := -shared -static-libgcc -L$(top_builddir)lib |
| 73 | LDFLAGS_tst-tlsmod7.so := -shared -static-libgcc -L$(top_builddir)lib |
| 74 | LDFLAGS_tst-tlsmod8.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 75 | tst-tlsmod7.so |
| 76 | LDFLAGS_tst-tlsmod9.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 77 | tst-tlsmod8.so |
| 78 | LDFLAGS_tst-tlsmod10.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 79 | tst-tlsmod9.so |
| 80 | LDFLAGS_tst-tlsmod11.so := -shared -static-libgcc -L$(top_builddir)lib |
| 81 | LDFLAGS_tst-tlsmod12.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 82 | tst-tlsmod11.so |
| 83 | LDFLAGS_tst-tlsmod13.so := -shared -static-libgcc -L$(top_builddir)lib |
| 84 | LDFLAGS_tst-tlsmod13a.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 85 | tst-tlsmod13.so |
| 86 | LDFLAGS_tst-tlsmod14a.so := -shared -static-libgcc -L$(top_builddir)lib |
| 87 | LDFLAGS_tst-tlsmod14b.so := -shared -static-libgcc -L$(top_builddir)lib |
| 88 | LDFLAGS_tst-tlsmod15a.so := -shared -static-libgcc -L$(top_builddir)lib |
| 89 | LDFLAGS_tst-tlsmod15b.so := -shared -static-libgcc -L$(top_builddir)lib |
| 90 | LDFLAGS_tst-tlsmod16a.so := -shared -static-libgcc -L$(top_builddir)lib |
| 91 | LDFLAGS_tst-tlsmod16b.so := -shared -static-libgcc -L$(top_builddir)lib |
| 92 | LDFLAGS_tst-tlsmod17a.so := -shared -static-libgcc -L$(top_builddir)lib |
| 93 | LDFLAGS_tst-tlsmod17b.so := -shared -static-libgcc -L$(top_builddir)lib \ |
| 94 | $(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes)) |
| 95 | LDFLAGS_tst-tlsmod18a.so := -shared -static-libgcc -L$(top_builddir)lib |
| 96 | LDFLAGS_tst-tlsmod-at-ctor.so := -shared -static-libgcc -L$(top_builddir)lib |
| 97 | |
| 98 | LDFLAGS_tst-tls3 := tst-tlsmod1.so tst-tlsmod4.so |
| 99 | LDFLAGS_tst-tls4 := -ldl |
| 100 | LDFLAGS_tst-tls5 := -ldl |
| 101 | LDFLAGS_tst-tls6 := -ldl |
| 102 | LDFLAGS_tst-tls7 := -ldl |
| 103 | LDFLAGS_tst-tls8 := -ldl |
| 104 | LDFLAGS_tst-tls9 := -ldl |
| 105 | LDFLAGS_tst-tls10 := -Wl,-rpath-link=. tst-tlsmod8.so |
| 106 | LDFLAGS_tst-tls11 := -Wl,-rpath-link=. tst-tlsmod10.so |
| 107 | LDFLAGS_tst-tls12 := -Wl,-rpath-link=. tst-tlsmod12.so |
| 108 | LDFLAGS_tst-tls13 := -ldl -Wl,-rpath-link=. |
| 109 | LDFLAGS_tst-tls14 := -ldl -Wl,-rpath-link=. tst-tlsmod14a.so |
| 110 | LDFLAGS_tst-tls15 := -ldl -Wl,-rpath-link=. |
| 111 | LDFLAGS_tst-tls16 := -ldl -Wl,-rpath-link=. |
| 112 | LDFLAGS_tst-tls17 := -ldl -Wl,-rpath-link=. |
| 113 | LDFLAGS_tst-tls18 := -ldl -Wl,-rpath-link=. |
| 114 | LDFLAGS_tst-tls-at-ctor := tst-tlsmod-at-ctor.so |
| 115 | |
| 116 | tst-tls3: tst-tlsmod1.so tst-tlsmod4.so |
| 117 | tst-tls4: tst-tlsmod2.so |
| 118 | tst-tls5: tst-tlsmod2.so |
| 119 | tst-tls6: tst-tlsmod2.so |
| 120 | tst-tls7: tst-tlsmod2.so tst-tlsmod3.so |
| 121 | tst-tls8: tst-tlsmod2.so tst-tlsmod3.so tst-tlsmod4.so |
| 122 | tst-tls9: tst-tlsmod5.so tst-tlsmod6.so |
| 123 | tst-tls10: tst-tlsmod7.so tst-tlsmod8.so |
| 124 | tst-tls11: tst-tlsmod9.so tst-tlsmod10.so |
| 125 | tst-tls12: tst-tlsmod11.so tst-tlsmod12.so |
| 126 | tst-tls13: tst-tlsmod13.so tst-tlsmod13a.so |
| 127 | tst-tls14: tst-tlsmod14a.so tst-tlsmod14b.so |
| 128 | tst-tls15: tst-tlsmod15b.so |
| 129 | tst-tls16: tst-tlsmod16a.so tst-tlsmod16b.so |
| 130 | tst-tls17: tst-tlsmod17b.so |
| 131 | tst-tlsmod17b.so: $(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes)) |
| 132 | tst-tlsmod17a%.so: tst-tlsmod17a.c |
| 133 | $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod17a.so) $< -o $@ \ |
| 134 | -DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \ |
| 135 | $(LDFLAGS_tst-tlsmod17a.so) |
| 136 | tst-tls18: $(patsubst %,tst-tlsmod18a%.so,$(tlsmod18a-suffixes)) |
| 137 | tst-tlsmod18a%.so: tst-tlsmod18a.c |
| 138 | $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod18a.so) $< -o $@ \ |
| 139 | -DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \ |
| 140 | $(LDFLAGS_tst-tlsmod18a.so) |
| 141 | tst-tls-at-ctor: tst-tlsmod-at-ctor.so |
| 142 | |
| 143 | ifeq ($(TARGET_ARCH),mips) |
| 144 | RET_tst-tls15 := 1 |
| 145 | endif |
| 146 | |
| 147 | WRAPPER := env LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" |