1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
# Makefile for uClibc NPTL
#
# Copyright (C) 2006 Steven J. Hill <sjhill@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
libpthread_CSRC = pthread_attr_getaffinity.c \
pthread_attr_setaffinity.c pthread_getaffinity.c \
pthread_getcpuclockid.c pthread_kill.c \
pthread_mutex_cond_lock.c pthread_setaffinity.c \
pthread_yield.c sem_post.c sem_timedwait.c \
pthread_sigqueue.c \
sem_trywait.c sem_wait.c pt-fork.c \
sigtimedwait.c sigwaitinfo.c sigwait.c pt-sleep.c
libpthread_SSRC = #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
libc_CSRC = libc_pthread_init.c libc_multiple_threads.c \
register-atfork.c unregister-atfork.c getpid.c \
raise.c sleep.c jmp-unwind.c
# These provide both a cancellable and a not cancellable implementation
libc_SSRC = close.S open.S write.S read.S waitpid.S
librt_CSRC := mq_notify.c timer_create.c timer_delete.c \
timer_getoverr.c timer_gettime.c timer_routines.c \
timer_settime.c
ifeq ($(TARGET_ARCH),alpha)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
librt_CSRC := mq_notify.c
endif
ifeq ($(TARGET_ARCH),arm)
libc_SSRC := $(filter-out waitpid.S,$(libc_SSRC))
libpthread_CSRC += lowlevelrobustlock.c
endif
ifeq ($(TARGET_ARCH),mips)
libpthread_CSRC += lowlevellock.c lowlevelrobustlock.c
libc_CSRC += libc-lowlevellock.c
endif
ifeq ($(TARGET_ARCH),powerpc)
libpthread_CSRC += lowlevellock.c lowlevelrobustlock.c
libc_CSRC += libc-lowlevellock.c
librt_CSRC += __syscall_error.c
endif
ifeq ($(TARGET_ARCH),sparc)
libpthread_CSRC += __syscall_error.c lowlevelrobustlock.c
librt_CSRC += __syscall_error.c
endif
ifeq ($(TARGET_ARCH),sh)
SH_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
libpthread_CSRC := $(filter-out $(SH_PTHREAD_SPECIFIC),$(libpthread_CSRC))
endif
ifeq ($(TARGET_ARCH),i386)
X86_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
libpthread_CSRC := $(filter-out $(X86_PTHREAD_SPECIFIC),$(libpthread_CSRC))
endif
ifeq ($(TARGET_ARCH),x86_64)
libc_SSRC := $(filter-out waitpid.S,$(libc_SSRC))
X64_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
libpthread_CSRC := $(filter-out $(X64_PTHREAD_SPECIFIC),$(libpthread_CSRC))
endif
CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)librt
CFLAGS-pt-pread_pwrite.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
-I$(top_srcdir)libc/sysdeps/linux/common
CFLAGS-mq_notify.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_create.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_delete.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_getoverr.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_gettime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_routines.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_settime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
#CFLAGS:=$(CFLAGS:-O1=-O2)
CFLAGS-OMIT-libc_pthread_init.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-libc_multiple_threads.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-register-atfork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-unregister-atfork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-getpid.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-sleep.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-close.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-open.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-read.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-write.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-waitpid.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-mq_notify.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_create.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_delete.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_getoverr.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread=1
PTHREAD_LINUX_DIR := $(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux
PTHREAD_LINUX_OUT := $(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux
PTHREAD_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_CSRC))
PTHREAD_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_SSRC))
ifeq ($(DOPIC),y)
libpthread-a-y += $(PTHREAD_LINUX_OBJ:.o=.os)
else
libpthread-a-y += $(PTHREAD_LINUX_OBJ)
endif
libpthread-so-y += $(PTHREAD_LINUX_OBJ:.o=.oS)
libpthread-so-y += $(PTHREAD_LINUX_OUT)/pt-raise.oS
libpthread-nomulti-y += $(PTHREAD_LINUX_OBJ)
ASFLAGS-open.S = -D_LIBC_REENTRANT
ASFLAGS-close.S = -D_LIBC_REENTRANT
ASFLAGS-read.S = -D_LIBC_REENTRANT
ASFLAGS-write.S = -D_LIBC_REENTRANT
ASFLAGS-waitpid.S = -D_LIBC_REENTRANT
LIBC_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libc_CSRC))
LIBC_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libc_SSRC))
libc-static-y += $(LIBC_LINUX_OBJ)
libc-shared-y += $(LIBC_LINUX_OBJ:.o=.oS)
libc-nomulti-y += $(LIBC_LINUX_OBJ)
LIBRT_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(librt_CSRC))
librt-a-y += $(LIBRT_LINUX_OBJ)
librt-so-y += $(LIBRT_LINUX_OBJ:.o=.oS)
objclean-y += CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
headers_clean-y += HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
#
# Create header files.
#
CFLAGS-gen_lowlevelbarrier.c = -S
CFLAGS-gen_lowlevelcond.c = -S
CFLAGS-gen_lowlevelrwlock.c = -S
CFLAGS-gen_lowlevelrobustlock.c = -S
CFLAGS-gen_lunwindbuf.c = -S
CFLAGS-gen_lstructsem.c = -S
CFLAGS-gen_lpthread-pi-defines.c = -S
$(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.c: $(PTHREAD_LINUX_DIR)/lowlevelbarrier.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lowlevelcond.c: $(PTHREAD_LINUX_DIR)/lowlevelcond.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrwlock.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrobustlock.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c: $(PTHREAD_LINUX_DIR)/unwindbuf.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lstructsem.c: $(PTHREAD_LINUX_DIR)/structsem.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c: $(PTHREAD_LINUX_DIR)/pthread-pi-defines.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
$(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lowlevelcond.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelcond.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.s: $(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lstructsem.s: $(PTHREAD_LINUX_OUT)/gen_lstructsem.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.s: $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c
$(compile.c)
$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h: $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/lowlevelcond.h: $(PTHREAD_LINUX_OUT)/gen_lowlevelcond.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/lowlevelrwlock.h: $(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h: $(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/unwindbuf.h: $(PTHREAD_LINUX_OUT)/gen_lunwindbuf.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/structsem.h: $(PTHREAD_LINUX_OUT)/gen_lstructsem.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
$(PTHREAD_LINUX_OUT)/pthread-pi-defines.h: $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += \
$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h \
$(PTHREAD_LINUX_OUT)/lowlevelcond.h \
$(PTHREAD_LINUX_OUT)/lowlevelrwlock.h \
$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h \
$(PTHREAD_LINUX_OUT)/unwindbuf.h \
$(PTHREAD_LINUX_OUT)/structsem.h \
$(PTHREAD_LINUX_OUT)/pthread-pi-defines.h
HEADERS_BITS_PTHREAD := $(notdir $(wildcard $(PTHREAD_LINUX_DIR)/bits/*.h))
ALL_HEADERS_BITS_PTHREAD := $(addprefix include/bits/,$(HEADERS_BITS_PTHREAD))
$(ALL_HEADERS_BITS_PTHREAD):
$(do_ln) ../../$(PTHREAD_LINUX_DIR)/bits/$(@F) $(top_builddir)$@
HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
$(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelcond., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lunwindbuf., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lstructsem., c s) \
$(addprefix $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines., c s) \
$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h \
$(PTHREAD_LINUX_OUT)/lowlevelcond.h \
$(PTHREAD_LINUX_OUT)/lowlevelrwlock.h \
$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h \
$(PTHREAD_LINUX_OUT)/unwindbuf.h \
$(PTHREAD_LINUX_OUT)/structsem.h \
$(PTHREAD_LINUX_OUT)/pthread-pi-defines.h
CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
$(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/*., o os oS)
|