v29.4-roots.1 · Commit 1: [PATCH 01/13] build: port platform and dependency support
cmake/introspection.cmake
Before: cmake/introspection.cmake · After: cmake/introspection.cmake
File metadata
index d4ed4866b9c4d4501ff9c7c7f1edfc8a5e6dea78..0bb852fa175e73c376be8f4d5fe07f7c49d0e555 100644
Download original patch · Release notes
Diff rows 1–173 of 173. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
cmake/introspection.cmake
CHANGED
|
@@ -102,6 +102,35 @@ check_cxx_source_compiles("
|
|
|
102
102
|
" HAVE_SOCKADDR_UN
|
|
103
103
|
)
|
|
104
104
|
|
|
105
|
+
# Check for close_range().
|
|
106
|
+
# NOTE: At least FreeBSD supports the generic variant.
|
|
107
|
+
check_cxx_source_compiles("
|
|
108
|
+
// same as in src/util/subprocess.cpp
|
|
109
|
+
#include <limits.h>
|
|
110
|
+
#include <unistd.h>
|
|
111
|
+
|
|
112
|
+
int main()
|
|
113
|
+
{
|
|
114
|
+
return close_range(3, UINT_MAX, 0);
|
|
115
|
+
}
|
|
116
|
+
" HAVE_CLOSE_RANGE_GENERIC
|
|
117
|
+
)
|
|
118
|
+
if(NOT HAVE_CLOSE_RANGE_GENERIC)
|
|
119
|
+
check_cxx_source_compiles("
|
|
120
|
+
// same as in src/util/subprocess.cpp
|
|
121
|
+
#define _GNU_SOURCE
|
|
122
|
+
#include <linux/close_range.h>
|
|
123
|
+
#include <limits.h>
|
|
124
|
+
#include <unistd.h>
|
|
125
|
+
|
|
126
|
+
int main()
|
|
127
|
+
{
|
|
128
|
+
return close_range(3, UINT_MAX, 0);
|
|
129
|
+
}
|
|
130
|
+
" HAVE_CLOSE_RANGE_LINUX
|
|
131
|
+
)
|
|
132
|
+
endif()
|
|
133
|
+
|
|
105
134
|
# Check for different ways of gathering OS randomness:
|
|
106
135
|
# - Linux getrandom()
|
|
107
136
|
check_cxx_source_compiles("
|
|
@@ -164,9 +193,16 @@ if(NOT MSVC)
|
|
|
164
193
|
|
|
165
194
|
# Check for SSE4.1 intrinsics.
|
|
166
195
|
set(SSE41_CXXFLAGS -msse4.1)
|
|
167
|
-
check_cxx_source_compiles_with_flags("
|
|
196
|
+
check_cxx_source_compiles_with_flags([[
|
|
168
197
|
#include <immintrin.h>
|
|
169
198
|
|
|
199
|
+
#if defined(__clang__)
|
|
200
|
+
#pragma clang attribute push(__attribute__((__target__("sse4.1"))), apply_to = function)
|
|
201
|
+
__attribute__((__target__("arch=skylake-avx512")))
|
|
202
|
+
#elif defined(__GNUC__)
|
|
203
|
+
#pragma GCC target ("sse4.1")
|
|
204
|
+
#endif
|
|
205
|
+
|
|
170
206
|
int main()
|
|
171
207
|
{
|
|
172
208
|
__m128i a = _mm_set1_epi32(0);
|
|
@@ -174,31 +210,51 @@ if(NOT MSVC)
|
|
|
174
210
|
__m128i r = _mm_blend_epi16(a, b, 0xFF);
|
|
175
211
|
return _mm_extract_epi32(r, 3);
|
|
176
212
|
}
|
|
177
|
-
" HAVE_SSE41
|
|
213
|
+
|
|
214
|
+
#if defined(__clang__)
|
|
215
|
+
#pragma clang attribute pop
|
|
216
|
+
#endif
|
|
217
|
+
]] HAVE_SSE41
|
|
178
218
|
CXXFLAGS ${SSE41_CXXFLAGS}
|
|
179
219
|
)
|
|
180
220
|
set(ENABLE_SSE41 ${HAVE_SSE41})
|
|
181
221
|
|
|
182
222
|
# Check for AVX2 intrinsics.
|
|
183
223
|
set(AVX2_CXXFLAGS -mavx -mavx2)
|
|
184
|
-
check_cxx_source_compiles_with_flags("
|
|
224
|
+
check_cxx_source_compiles_with_flags([[
|
|
185
225
|
#include <immintrin.h>
|
|
186
226
|
|
|
227
|
+
#if defined(__clang__)
|
|
228
|
+
#pragma clang attribute push(__attribute__((__target__("avx,avx2"))), apply_to = function)
|
|
229
|
+
#elif defined(__GNUC__)
|
|
230
|
+
#pragma GCC target ("avx,avx2")
|
|
231
|
+
#endif
|
|
232
|
+
|
|
187
233
|
int main()
|
|
188
234
|
{
|
|
189
235
|
__m256i l = _mm256_set1_epi32(0);
|
|
190
236
|
return _mm256_extract_epi32(l, 7);
|
|
191
237
|
}
|
|
192
|
-
" HAVE_AVX2
|
|
238
|
+
|
|
239
|
+
#if defined(__clang__)
|
|
240
|
+
#pragma clang attribute pop
|
|
241
|
+
#endif
|
|
242
|
+
]] HAVE_AVX2
|
|
193
243
|
CXXFLAGS ${AVX2_CXXFLAGS}
|
|
194
244
|
)
|
|
195
245
|
set(ENABLE_AVX2 ${HAVE_AVX2})
|
|
196
246
|
|
|
197
247
|
# Check for x86 SHA-NI intrinsics.
|
|
198
248
|
set(X86_SHANI_CXXFLAGS -msse4 -msha)
|
|
199
|
-
check_cxx_source_compiles_with_flags("
|
|
249
|
+
check_cxx_source_compiles_with_flags([[
|
|
200
250
|
#include <immintrin.h>
|
|
201
251
|
|
|
252
|
+
#if defined(__clang__)
|
|
253
|
+
#pragma clang attribute push(__attribute__((__target__("sse4,sse4.1,sha"))), apply_to = function)
|
|
254
|
+
#elif defined(__GNUC__)
|
|
255
|
+
#pragma GCC target ("sse4,sse4.1,sha")
|
|
256
|
+
#endif
|
|
257
|
+
|
|
202
258
|
int main()
|
|
203
259
|
{
|
|
204
260
|
__m128i i = _mm_set1_epi32(0);
|
|
@@ -206,16 +262,26 @@ if(NOT MSVC)
|
|
|
206
262
|
__m128i k = _mm_set1_epi32(2);
|
|
207
263
|
return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, j, k), 0);
|
|
208
264
|
}
|
|
209
|
-
" HAVE_X86_SHANI
|
|
265
|
+
|
|
266
|
+
#if defined(__clang__)
|
|
267
|
+
#pragma clang attribute pop
|
|
268
|
+
#endif
|
|
269
|
+
]] HAVE_X86_SHANI
|
|
210
270
|
CXXFLAGS ${X86_SHANI_CXXFLAGS}
|
|
211
271
|
)
|
|
212
272
|
set(ENABLE_X86_SHANI ${HAVE_X86_SHANI})
|
|
213
273
|
|
|
214
274
|
# Check for ARMv8 SHA-NI intrinsics.
|
|
215
275
|
set(ARM_SHANI_CXXFLAGS -march=armv8-a+crypto)
|
|
216
|
-
check_cxx_source_compiles_with_flags("
|
|
276
|
+
check_cxx_source_compiles_with_flags([[
|
|
217
277
|
#include <arm_neon.h>
|
|
218
278
|
|
|
279
|
+
#if defined(__clang__)
|
|
280
|
+
#pragma clang attribute push(__attribute__((__target__("armv8-a+crypto"))), apply_to = function)
|
|
281
|
+
#elif defined(__GNUC__)
|
|
282
|
+
#pragma GCC target ("armv8-a+crypto")
|
|
283
|
+
#endif
|
|
284
|
+
|
|
219
285
|
int main()
|
|
220
286
|
{
|
|
221
287
|
uint32x4_t a, b, c;
|
|
@@ -224,8 +290,37 @@ if(NOT MSVC)
|
|
|
224
290
|
vsha256su0q_u32(a, b);
|
|
225
291
|
vsha256su1q_u32(a, b, c);
|
|
226
292
|
}
|
|
227
|
-
" HAVE_ARM_SHANI
|
|
293
|
+
|
|
294
|
+
#if defined(__clang__)
|
|
295
|
+
#pragma clang attribute pop
|
|
296
|
+
#endif
|
|
297
|
+
]] HAVE_ARM_SHANI
|
|
228
298
|
CXXFLAGS ${ARM_SHANI_CXXFLAGS}
|
|
229
299
|
)
|
|
230
300
|
set(ENABLE_ARM_SHANI ${HAVE_ARM_SHANI})
|
|
301
|
+
|
|
302
|
+
# Check for POWER8 vector intrinsics.
|
|
303
|
+
function(check_power8_vector VAR)
|
|
304
|
+
check_cxx_source_compiles_with_flags([[
|
|
305
|
+
#include <altivec.h>
|
|
306
|
+
#include <stdint.h>
|
|
307
|
+
|
|
308
|
+
int main()
|
|
309
|
+
{
|
|
310
|
+
unsigned char src[16];
|
|
311
|
+
__builtin_crypto_vshasigmaw((__vector uint32_t)vec_vsx_ld(0, src), 1, 0xf);
|
|
312
|
+
return 0;
|
|
313
|
+
}
|
|
314
|
+
]] ${VAR}
|
|
315
|
+
CXXFLAGS ${POWER8_CXXFLAGS}
|
|
316
|
+
)
|
|
317
|
+
endfunction()
|
|
318
|
+
set(POWER8_CXXFLAGS -mpower8-vector)
|
|
319
|
+
check_power8_vector(HAVE_POWER8_VECTOR)
|
|
320
|
+
set(ENABLE_POWER8 ${HAVE_POWER8_VECTOR})
|
|
321
|
+
if(NOT HAVE_POWER8_VECTOR)
|
|
322
|
+
set(POWER8_CXXFLAGS -mcpu=power8)
|
|
323
|
+
check_power8_vector(HAVE_MCPU_POWER8_FOR_VECTOR)
|
|
324
|
+
set(ENABLE_POWER8 ${HAVE_MCPU_POWER8_FOR_VECTOR})
|
|
325
|
+
endif()
|
|
231
326
|
endif()
|