clang on windows support

This commit is contained in:
wuggy 2026-09-10 08:32:59 -07:00
commit 1d44f05fba
22 changed files with 208 additions and 65 deletions

View file

@ -31,6 +31,15 @@ if CONFIG['INTEL_ARCHITECTURE']:
'inflate_simd.c',
'x86.c',
]
# Clang (including clang-cl) and GCC require explicit ISA flags for
# intrinsics. MSVC accepts these intrinsics without additional flags.
# Keep advanced instructions confined to the runtime-dispatched sources.
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
SOURCES['adler32_simd.c'].flags += ['-mssse3']
for source in ['crc32_simd.c', 'crc_folding.c']:
SOURCES[source].flags += ['-msse4.2', '-mpclmul']
for source in ['fill_window_sse.c', 'inffast_chunk.c', 'inflate_simd.c']:
SOURCES[source].flags += ['-msse2']
else:
SOURCES += [
'simd_stub.c',

View file

@ -65,8 +65,8 @@ static void _x86_check_features(void)
#include <windows.h>
#include <stdint.h>
static volatile int32_t once_control = 0;
static int fake_pthread_once(volatile int32_t *once_control,
static volatile LONG once_control = 0;
static int fake_pthread_once(volatile LONG *once_control,
void (*init_routine)(void));
void x86_check_features(void)
@ -75,7 +75,7 @@ void x86_check_features(void)
}
/* Copied from "perftools_pthread_once" in tcmalloc */
static int fake_pthread_once(volatile int32_t *once_control,
static int fake_pthread_once(volatile LONG *once_control,
void (*init_routine)(void)) {
// Try for a fast path first. Note: this should be an acquire semantics read
// It is on x86 and x64, where Windows runs.