Skip to content

Commit 6f94515

Browse files
committed
raw: crt: Add arm/aarch64 with glibc
1 parent bb63df6 commit 6f94515

File tree

7 files changed

+186
-74
lines changed

7 files changed

+186
-74
lines changed
File renamed without changes.

glibc.fbfrog

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# GNU/Linux only - no DOS, no Windows
2-
-target linux-x86family
3-
4-
-replacements glibc.replacements
5-
61
# config.h
72
-define HAVE_ASM_WEAK_DIRECTIVE 1
83
-define HAVE_ASM_WEAKEXT_DIRECTIVE 1

inc/crt/bits/pthreadtypes.bi

Lines changed: 144 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -24,120 +24,187 @@
2424
#pragma once
2525

2626
#include once "crt/long.bi"
27-
#include once "bits/wordsize.bi"
27+
28+
#ifdef __FB_ARM__
29+
#include once "endian.bi"
30+
#else
31+
#include once "bits/wordsize.bi"
32+
#endif
2833

2934
const _BITS_PTHREADTYPES_H = 1
3035

31-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
36+
#ifndef __FB_64BIT__
37+
const __SIZEOF_PTHREAD_ATTR_T = 36
38+
const __SIZEOF_PTHREAD_MUTEX_T = 24
39+
#elseif defined(__FB_64BIT__) and (not defined(__FB_ARM__))
3240
const __SIZEOF_PTHREAD_ATTR_T = 56
3341
const __SIZEOF_PTHREAD_MUTEX_T = 40
42+
#endif
43+
44+
#if defined(__FB_64BIT__) and defined(__FB_ARM__)
45+
const __SIZEOF_PTHREAD_ATTR_T = 64
46+
const __SIZEOF_PTHREAD_MUTEX_T = 48
47+
const __SIZEOF_PTHREAD_MUTEXATTR_T = 8
3448
#else
35-
const __SIZEOF_PTHREAD_ATTR_T = 36
36-
const __SIZEOF_PTHREAD_MUTEX_T = 24
49+
const __SIZEOF_PTHREAD_MUTEXATTR_T = 4
3750
#endif
3851

39-
const __SIZEOF_PTHREAD_MUTEXATTR_T = 4
4052
const __SIZEOF_PTHREAD_COND_T = 48
41-
const __SIZEOF_PTHREAD_CONDATTR_T = 4
4253

43-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
44-
const __SIZEOF_PTHREAD_RWLOCK_T = 56
45-
#else
54+
#if (not defined(__FB_64BIT__)) and defined(__FB_ARM__)
55+
const __SIZEOF_PTHREAD_COND_COMPAT_T = 12
56+
#endif
57+
58+
#if (defined(__FB_64BIT__) and (not defined(__FB_ARM__))) or (not defined(__FB_64BIT__))
59+
const __SIZEOF_PTHREAD_CONDATTR_T = 4
60+
#endif
61+
62+
#ifndef __FB_64BIT__
4663
const __SIZEOF_PTHREAD_RWLOCK_T = 32
64+
#elseif defined(__FB_64BIT__) and defined(__FB_ARM__)
65+
const __SIZEOF_PTHREAD_COND_COMPAT_T = 48
66+
const __SIZEOF_PTHREAD_CONDATTR_T = 8
67+
#endif
68+
69+
#ifdef __FB_64BIT__
70+
const __SIZEOF_PTHREAD_RWLOCK_T = 56
4771
#endif
4872

4973
const __SIZEOF_PTHREAD_RWLOCKATTR_T = 8
5074

51-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
75+
#ifdef __FB_64BIT__
5276
const __SIZEOF_PTHREAD_BARRIER_T = 32
5377
#else
5478
const __SIZEOF_PTHREAD_BARRIER_T = 20
5579
#endif
5680

57-
const __SIZEOF_PTHREAD_BARRIERATTR_T = 4
81+
#if defined(__FB_64BIT__) and defined(__FB_ARM__)
82+
const __SIZEOF_PTHREAD_BARRIERATTR_T = 8
83+
#else
84+
const __SIZEOF_PTHREAD_BARRIERATTR_T = 4
85+
#endif
86+
5887
type pthread_t as culong
5988

6089
union pthread_attr_t
61-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
90+
#ifndef __FB_64BIT__
91+
__size as zstring * 36
92+
#elseif defined(__FB_64BIT__) and (not defined(__FB_ARM__))
6293
__size as zstring * 56
6394
#else
64-
__size as zstring * 36
95+
__size as zstring * 64
6596
#endif
6697

6798
__align as clong
6899
end union
69100

70-
const __have_pthread_attr_t = 1
71-
72-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
73-
type __pthread_internal_list
74-
__prev as __pthread_internal_list ptr
75-
__next as __pthread_internal_list ptr
76-
end type
101+
#if (defined(__FB_64BIT__) and (not defined(__FB_ARM__))) or (not defined(__FB_64BIT__))
102+
const __have_pthread_attr_t = 1
103+
#endif
77104

78-
type __pthread_list_t as __pthread_internal_list
79-
#else
105+
#ifndef __FB_64BIT__
80106
type __pthread_internal_slist
81107
__next as __pthread_internal_slist ptr
82108
end type
83109

84110
type __pthread_slist_t as __pthread_internal_slist
111+
#endif
85112

113+
#if (not defined(__FB_64BIT__)) and (not defined(__FB_ARM__))
86114
type pthread_mutex_t___pthread_mutex_s___elision_data
87115
__espins as short
88116
__elision as short
89117
end type
118+
#elseif defined(__FB_64BIT__) and defined(__FB_ARM__)
119+
#define __have_pthread_attr_t1
120+
#endif
121+
122+
#ifdef __FB_64BIT__
123+
type __pthread_internal_list
124+
__prev as __pthread_internal_list ptr
125+
__next as __pthread_internal_list ptr
126+
end type
127+
128+
type __pthread_list_t as __pthread_internal_list
90129
#endif
91130

92131
type __pthread_mutex_s
93132
__lock as long
94133
__count as ulong
95134
__owner as long
96135

97-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
136+
#ifdef __FB_64BIT__
98137
__nusers as ulong
99138
#endif
100139

101140
__kind as long
102141

103-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
104-
__spins as short
105-
__elision as short
106-
__list as __pthread_list_t
107-
#else
142+
#ifndef __FB_64BIT__
108143
__nusers as ulong
109144

110145
union
111-
__elision_data as pthread_mutex_t___pthread_mutex_s___elision_data
146+
#if (not defined(__FB_64BIT__)) and (not defined(__FB_ARM__))
147+
__elision_data as pthread_mutex_t___pthread_mutex_s___elision_data
148+
#elseif (not defined(__FB_64BIT__)) and defined(__FB_ARM__)
149+
__spins as long
150+
#endif
151+
112152
__list as __pthread_slist_t
113153
end union
154+
#elseif defined(__FB_64BIT__) and (not defined(__FB_ARM__))
155+
__spins as short
156+
__elision as short
157+
#else
158+
__spins as long
159+
#endif
160+
161+
#ifdef __FB_64BIT__
162+
__list as __pthread_list_t
114163
#endif
115164
end type
116165

117166
union pthread_mutex_t
118167
__data as __pthread_mutex_s
119168

120-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
169+
#ifndef __FB_64BIT__
170+
__size as zstring * 24
171+
#elseif defined(__FB_64BIT__) and (not defined(__FB_ARM__))
121172
__size as zstring * 40
122173
#else
123-
__size as zstring * 24
174+
__size as zstring * 48
124175
#endif
125176

126177
__align as clong
127178
end union
128179

129-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
130-
const __PTHREAD_MUTEX_HAVE_PREV = 1
131-
#define __PTHREAD_SPINS 0, 0
132-
#else
180+
#if (not defined(__FB_64BIT__)) and (not defined(__FB_ARM__))
133181
#define __spins __elision_data.__espins
134182
#define __elision __elision_data.__elision
135183
#define __PTHREAD_SPINS (0, 0)
184+
#elseif defined(__FB_64BIT__)
185+
const __PTHREAD_MUTEX_HAVE_PREV = 1
186+
#endif
187+
188+
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
189+
#define __PTHREAD_SPINS 0, 0
190+
#elseif defined(__FB_ARM__)
191+
const __PTHREAD_SPINS = 0
136192
#endif
137193

138194
union pthread_mutexattr_t
139-
__size as zstring * 4
140-
__align as long
195+
#if (defined(__FB_64BIT__) and (not defined(__FB_ARM__))) or (not defined(__FB_64BIT__))
196+
__size as zstring * 4
197+
#endif
198+
199+
#ifndef __FB_ARM__
200+
__align as long
201+
#elseif defined(__FB_64BIT__) and defined(__FB_ARM__)
202+
__size as zstring * 8
203+
#endif
204+
205+
#ifdef __FB_ARM__
206+
__align as clong
207+
#endif
141208
end union
142209

143210
type pthread_cond_t___data
@@ -154,12 +221,26 @@ end type
154221
union pthread_cond_t
155222
__data as pthread_cond_t___data
156223
__size as zstring * 48
157-
__align as longint
224+
225+
#if defined(__FB_64BIT__) and defined(__FB_ARM__)
226+
__align as clong
227+
#else
228+
__align as longint
229+
#endif
158230
end union
159231

160232
union pthread_condattr_t
161-
__size as zstring * 4
162-
__align as long
233+
#if defined(__FB_64BIT__) and defined(__FB_ARM__)
234+
__size as zstring * 8
235+
#else
236+
__size as zstring * 4
237+
#endif
238+
239+
#if (not defined(__FB_64BIT__)) and defined(__FB_ARM__)
240+
__align as clong
241+
#else
242+
__align as long
243+
#endif
163244
end union
164245

165246
type pthread_key_t as ulong
@@ -173,30 +254,39 @@ type pthread_rwlock_t___data
173254
__nr_readers_queued as ulong
174255
__nr_writers_queued as ulong
175256

176-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
257+
#ifdef __FB_64BIT__
177258
__writer as long
178259
__shared as long
179260
#else
180261
__flags as ubyte
181262
__shared as ubyte
182263
#endif
183264

184-
__rwelision as byte
265+
#ifndef __FB_ARM__
266+
__rwelision as byte
267+
#elseif (not defined(__FB_64BIT__)) and defined(__FB_ARM__)
268+
__pad1 as ubyte
269+
#endif
185270

186-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
271+
#ifndef __FB_64BIT__
272+
__pad2 as ubyte
273+
__writer as long
274+
#elseif defined(__FB_64BIT__) and (not defined(__FB_ARM__))
187275
__pad1(0 to 6) as ubyte
276+
#else
277+
__pad1 as culong
278+
#endif
279+
280+
#ifdef __FB_64BIT__
188281
__pad2 as culong
189282
__flags as ulong
190-
#else
191-
__pad2 as ubyte
192-
__writer as long
193283
#endif
194284
end type
195285

196286
union pthread_rwlock_t
197287
__data as pthread_rwlock_t___data
198288

199-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
289+
#ifdef __FB_64BIT__
200290
__size as zstring * 56
201291
#else
202292
__size as zstring * 32
@@ -220,7 +310,7 @@ end union
220310
type pthread_spinlock_t as long
221311

222312
union pthread_barrier_t
223-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
313+
#ifdef __FB_64BIT__
224314
__size as zstring * 32
225315
#else
226316
__size as zstring * 20
@@ -230,6 +320,11 @@ union pthread_barrier_t
230320
end union
231321

232322
union pthread_barrierattr_t
233-
__size as zstring * 4
323+
#if defined(__FB_64BIT__) and defined(__FB_ARM__)
324+
__size as zstring * 8
325+
#else
326+
__size as zstring * 4
327+
#endif
328+
234329
__align as long
235330
end union

inc/crt/bits/wordsize.bi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#pragma once
2525

26-
#if defined(__FB_64BIT__) and (not defined(__FB_ARM__))
26+
#ifdef __FB_64BIT__
2727
const __WORDSIZE = 64
2828
#else
2929
const __WORDSIZE = 32

0 commit comments

Comments
 (0)