[ Web Proxy ]
URL:
Viewing:
https://github-redirect.dependabot.com/python/cpython/blob/main/Misc/platform_triplet.c
[Back]
[Original]
cpython/Misc/platform_triplet.c at main python/cpython GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
[]
[]
GitHub
Repository hosting, code review, and collaboration
[]
[]
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
[]
[]
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
[]
[]
GitHub Universe
The event for developers, by developers talks, workshops, and whats next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.3k
(2.3k)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
cpython
/
Misc
/
platform_triplet.c
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
316 lines (313 loc) 8.34 KB
main
Breadcrumbs
cpython
/
Misc
/
platform_triplet.c
Copy path
Top
File metadata and controls
Code
Blame
316 lines (313 loc) 8.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/* Detect platform triplet from builtin defines
* cc -E Misc/platform_triplet.c | grep '^PLATFORM_TRIPLET=' | tr -d ' '
*/
#undef
bfin
#undef
cris
#undef
fr30
#undef
linux
#undef
hppa
#undef
hpux
#undef
i386
#undef
mips
#undef
powerpc
#undef
sparc
#undef
unix
#if
defined(
__ANDROID__
)
# if
defined(
__x86_64__
)
PLATFORM_TRIPLET
=
x86_64
-
linux
-
android
# elif
defined(
__i386__
)
PLATFORM_TRIPLET
=
i686
-
linux
-
android
# elif
defined(
__aarch64__
)
PLATFORM_TRIPLET
=
aarch64
-
linux
-
android
# elif
defined(
__arm__
)
PLATFORM_TRIPLET
=
arm
-
linux
-
androideabi
# else
# error
unknown Android platform
# endif
#elif
defined(
__linux__
)
/*
* BEGIN of Linux block
*/
// Detect libc (based on config.guess)
# include
<features.h>
# if
defined(
__UCLIBC__
)
# error
uclibc not supported
# elif
defined(
__dietlibc__
)
# error
dietlibc not supported
# elif
defined(
__GLIBC__
)
# define
LIBC
gnu
# define
LIBC_X32
gnux32
# if
defined(
__ARM_PCS_VFP
)
# define
LIBC_ARM
gnueabihf
# else
# define
LIBC_ARM
gnueabi
# endif
# if
defined(
__loongarch__
)
# if
defined(
__loongarch_soft_float
)
# define
LIBC_LA
gnusf
# elif
defined(
__loongarch_single_float
)
# define
LIBC_LA
gnuf32
# elif
defined(
__loongarch_double_float
)
# define
LIBC_LA
gnu
# else
# error
unknown loongarch floating-point base abi
# endif
# endif
# if
defined(
_MIPS_SIM
)
# if
defined(
__mips_hard_float
)
# if
defined(
_ABIO32
)
&&
_MIPS_SIM
==
_ABIO32
# define
LIBC_MIPS
gnu
# elif
defined(
_ABIN32
)
&&
_MIPS_SIM
==
_ABIN32
# define
LIBC_MIPS
gnuabin32
# elif
defined(
_ABI64
)
&&
_MIPS_SIM
==
_ABI64
# define
LIBC_MIPS
gnuabi64
# else
# error
unknown mips sim value
# endif
# else
# if
defined(
_ABIO32
)
&&
_MIPS_SIM
==
_ABIO32
# define
LIBC_MIPS
gnusf
# elif
defined(
_ABIN32
)
&&
_MIPS_SIM
==
_ABIN32
# define
LIBC_MIPS
gnuabin32sf
# elif
defined(
_ABI64
)
&&
_MIPS_SIM
==
_ABI64
# define
LIBC_MIPS
gnuabi64sf
# else
# error
unknown mips sim value
# endif
# endif
# endif
# if
defined(
__SPE__
)
# define
LIBC_PPC
gnuspe
# else
# define
LIBC_PPC
gnu
# endif
# else
// Heuristic to detect musl libc
# include
<stdarg.h>
# ifdef
__DEFINED_va_list
# define
LIBC
musl
# define
LIBC_X32
muslx32
# if
defined(
__ARM_PCS_VFP
)
# define
LIBC_ARM
musleabihf
# else
# define
LIBC_ARM
musleabi
# endif
# if
defined(
__loongarch__
)
# if
defined(
__loongarch_soft_float
)
# define
LIBC_LA
muslsf
# elif
defined(
__loongarch_single_float
)
# define
LIBC_LA
muslf32
# elif
defined(
__loongarch_double_float
)
# define
LIBC_LA
musl
# else
# error
unknown loongarch floating-point base abi
# endif
# endif
# if
defined(
_MIPS_SIM
)
# if
defined(
__mips_hard_float
)
# if
defined(
_ABIO32
)
&&
_MIPS_SIM
==
_ABIO32
# define
LIBC_MIPS
musl
# elif
defined(
_ABIN32
)
&&
_MIPS_SIM
==
_ABIN32
# define
LIBC_MIPS
musln32
# elif
defined(
_ABI64
)
&&
_MIPS_SIM
==
_ABI64
# define
LIBC_MIPS
musl
# else
# error
unknown mips sim value
# endif
# else
# if
defined(
_ABIO32
)
&&
_MIPS_SIM
==
_ABIO32
# define
LIBC_MIPS
muslsf
# elif
defined(
_ABIN32
)
&&
_MIPS_SIM
==
_ABIN32
# define
LIBC_MIPS
musln32sf
# elif
defined(
_ABI64
)
&&
_MIPS_SIM
==
_ABI64
# define
LIBC_MIPS
muslsf
# else
# error
unknown mips sim value
# endif
# endif
# endif
# if
defined(
_SOFT_FLOAT
)
||
defined(
__NO_FPRS__
)
# define
LIBC_PPC
muslsf
# else
# define
LIBC_PPC
musl
# endif
# else
# error
unknown libc
# endif
# endif
# if
defined(
__x86_64__
)
&&
defined(
__LP64__
)
PLATFORM_TRIPLET
=
x86_64
-
linux
-
LIBC
# elif
defined(
__x86_64__
)
&&
defined(
__ILP32__
)
PLATFORM_TRIPLET
=
x86_64
-
linux
-
LIBC_X32
# elif
defined(
__i386__
)
PLATFORM_TRIPLET
=
i386
-
linux
-
LIBC
# elif
defined(
__aarch64__
)
&&
defined(
__AARCH64EL__
)
# if
defined(
__ILP32__
)
PLATFORM_TRIPLET
=
aarch64_ilp32
-
linux
-
LIBC
# else
PLATFORM_TRIPLET
=
aarch64
-
linux
-
LIBC
# endif
# elif
defined(
__aarch64__
)
&&
defined(
__AARCH64EB__
)
# if
defined(
__ILP32__
)
PLATFORM_TRIPLET
=
aarch64_be_ilp32
-
linux
-
LIBC
# else
PLATFORM_TRIPLET
=
aarch64_be
-
linux
-
LIBC
# endif
# elif
defined(
__alpha__
)
PLATFORM_TRIPLET
=
alpha
-
linux
-
LIBC
# elif
defined(
__ARM_EABI__
)
# if
defined(
__ARMEL__
)
PLATFORM_TRIPLET
=
arm
-
linux
-
LIBC_ARM
# else
PLATFORM_TRIPLET
=
armeb
-
linux
-
LIBC_ARM
# endif
# elif
defined(
__hppa__
)
PLATFORM_TRIPLET
=
hppa
-
linux
-
LIBC
# elif
defined(
__ia64__
)
PLATFORM_TRIPLET
=
ia64
-
linux
-
LIBC
# elif
defined(
__loongarch__
)
&&
defined(
__loongarch_lp64
)
PLATFORM_TRIPLET
=
loongarch64
-
linux
-
LIBC_LA
# elif
defined(
__m68k__
)
&&
!defined(
__mcoldfire__
)
PLATFORM_TRIPLET
=
m68k
-
linux
-
LIBC
# elif
defined(
__mips__
)
# if
defined(
__mips_isa_rev
)
&&
(
__mips_isa_rev
>=
6
)
# if
defined(
_MIPSEL
)
&&
defined(
__mips64
)
PLATFORM_TRIPLET
=
mipsisa64r6el
-
linux
-
LIBC_MIPS
# elif
defined(
_MIPSEL
)
PLATFORM_TRIPLET
=
mipsisa32r6el
-
linux
-
LIBC_MIPS
# elif
defined(
__mips64
)
PLATFORM_TRIPLET
=
mipsisa64r6
-
linux
-
LIBC_MIPS
# else
PLATFORM_TRIPLET
=
mipsisa32r6
-
linux
-
LIBC_MIPS
# endif
# else
# if
defined(
_MIPSEL
)
&&
defined(
__mips64
)
PLATFORM_TRIPLET
=
mips64el
-
linux
-
LIBC_MIPS
# elif
defined(
_MIPSEL
)
PLATFORM_TRIPLET
=
mipsel
-
linux
-
LIBC_MIPS
# elif
defined(
__mips64
)
PLATFORM_TRIPLET
=
mips64
-
linux
-
LIBC_MIPS
# else
PLATFORM_TRIPLET
=
mips
-
linux
-
LIBC_MIPS
# endif
# endif
# elif
defined(
__or1k__
)
PLATFORM_TRIPLET
=
or1k
-
linux
-
LIBC
# elif
defined(
__powerpc64__
)
# if
defined(
__LITTLE_ENDIAN__
)
PLATFORM_TRIPLET
=
powerpc64le
-
linux
-
LIBC
# else
PLATFORM_TRIPLET
=
powerpc64
-
linux
-
LIBC
# endif
# elif
defined(
__powerpc__
)
PLATFORM_TRIPLET
=
powerpc
-
linux
-
LIBC_PPC
# elif
defined(
__s390x__
)
PLATFORM_TRIPLET
=
s390x
-
linux
-
LIBC
# elif
defined(
__s390__
)
PLATFORM_TRIPLET
=
s390
-
linux
-
LIBC
# elif
defined(
__sh__
)
&&
defined(
__LITTLE_ENDIAN__
)
PLATFORM_TRIPLET
=
sh4
-
linux
-
LIBC
# elif
defined(
__sparc__
)
&&
defined(
__arch64__
)
PLATFORM_TRIPLET
=
sparc64
-
linux
-
LIBC
# elif
defined(
__sparc__
)
PLATFORM_TRIPLET
=
sparc
-
linux
-
LIBC
# elif
defined(
__riscv
)
# if
__riscv_xlen
==
32
PLATFORM_TRIPLET
=
riscv32
-
linux
-
LIBC
# elif
__riscv_xlen
==
64
PLATFORM_TRIPLET
=
riscv64
-
linux
-
LIBC
# else
# error
unknown platform triplet
# endif
# else
# error
unknown platform triplet
# endif
/*
* END of Linux block
*/
#elif
defined(
__FreeBSD_kernel__
)
# if
defined(
__LP64__
)
PLATFORM_TRIPLET
=
x86_64
-
kfreebsd
-
gnu
# elif
defined(
__i386__
)
PLATFORM_TRIPLET
=
i386
-
kfreebsd
-
gnu
# else
# error
unknown platform triplet
# endif
#elif
defined(
__gnu_hurd__
)
# if
defined(
__x86_64__
)
&&
defined(
__LP64__
)
PLATFORM_TRIPLET
=
x86_64
-
gnu
# elif
defined(
__i386__
)
PLATFORM_TRIPLET
=
i386
-
gnu
# else
# error
unknown platform triplet
# endif
#elif
defined(
__APPLE__
)
# include
"TargetConditionals.h"
// Older macOS SDKs do not define TARGET_OS_*
# if
defined(
TARGET_OS_IOS
)
&&
TARGET_OS_IOS
# if
defined(
TARGET_OS_SIMULATOR
)
&&
TARGET_OS_SIMULATOR
# if
__x86_64__
PLATFORM_TRIPLET
=
x86_64
-
iphonesimulator
# else
PLATFORM_TRIPLET
=
arm64
-
iphonesimulator
# endif
# else
PLATFORM_TRIPLET
=
arm64
-
iphoneos
# endif
# elif
defined(
TARGET_OS_TV
)
&&
TARGET_OS_TV
# if
defined(
TARGET_OS_SIMULATOR
)
&&
TARGET_OS_SIMULATOR
# if
__x86_64__
PLATFORM_TRIPLET
=
x86_64
-
appletvsimulator
# else
PLATFORM_TRIPLET
=
arm64
-
appletvsimulator
# endif
# else
PLATFORM_TRIPLET
=
arm64
-
appletvos
# endif
# elif
defined(
TARGET_OS_WATCH
)
&&
TARGET_OS_WATCH
# if
defined(
TARGET_OS_SIMULATOR
)
&&
TARGET_OS_SIMULATOR
# if
__x86_64__
PLATFORM_TRIPLET
=
x86_64
-
watchsimulator
# else
PLATFORM_TRIPLET
=
arm64
-
watchsimulator
# endif
# else
PLATFORM_TRIPLET
=
arm64_32
-
watchos
# endif
# elif
defined(
TARGET_OS_VISION
)
&&
TARGET_OS_VISION
# if
defined(
TARGET_OS_SIMULATOR
)
&&
TARGET_OS_SIMULATOR
PLATFORM_TRIPLET
=
arm64
-
xrsimulator
# else
PLATFORM_TRIPLET
=
arm64
-
xros
# endif
// Older macOS SDKs do not define TARGET_OS_OSX
# elif
!defined(
TARGET_OS_OSX
)
||
TARGET_OS_OSX
PLATFORM_TRIPLET
=
darwin
# else
# error
unknown Apple platform
# endif
#elif
defined(
__VXWORKS__
)
PLATFORM_TRIPLET
=
vxworks
#elif
defined(
__wasm32__
)
# if
defined(
__EMSCRIPTEN__
)
PLATFORM_TRIPLET
=
wasm32
-
emscripten
# elif
defined(
__wasi__
)
# if
defined(
_REENTRANT
)
PLATFORM_TRIPLET
=
wasm32
-
wasi
-
threads
# else
PLATFORM_TRIPLET
=
wasm32
-
wasi
# endif
# else
# error
unknown wasm32 platform
# endif
#elif
defined(
__wasm64__
)
# if
defined(
__EMSCRIPTEN__
)
PLATFORM_TRIPLET
=
wasm64
-
emscripten
# elif
defined(
__wasi__
)
PLATFORM_TRIPLET
=
wasm64
-
wasi
# else
# error
unknown wasm64 platform
# endif
#else
# error
unknown platform triplet
#endif
Footer
© 2026 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Community
Docs
Contact
Manage cookies
Do not share my personal information
You cant perform that action at this time.
Web Proxy Viewer |
New URL
|
Original Page