Windows 2000 and XP¶
A sysroot built with WINNT=0x0500 (or 0x0501) makes C and C++ programs
for Windows 2000 and XP with an NT 5 version in the triple.
| Windows | Triple | Subsystem version |
|---|---|---|
| 2000 | i586-pc-windows5.0-gnu |
5.00 |
| XP | i586-pc-windows5.1-gnu |
5.01 |
| Server 2003 | i586-pc-windows5.2-gnu |
5.02 |
LLVM_SRC=~/llvm MINGW_SRC=~/mingw-w64 BIN=~/llvm/build/bin \
SYSROOT=~/xp-sysroot WINNT=0x0501 CPU=i586 sh scripts/build-win9x.sh
LLVM_SRC=~/llvm BIN=~/llvm/build/bin SYSROOT=~/xp-sysroot CPU=i586 \
sh scripts/build-cxx.sh
clang --target=i586-pc-windows5.1-gnu --sysroot=$SYSROOT -fuse-ld=lld \
hello.c -o hello.exe
clang++ --target=i586-pc-windows5.1-gnu --sysroot=$SYSROOT -fuse-ld=lld \
-stdlib=libc++ hello.cpp -o hello.exe
- Programs import the system
msvcrt.dll, which both versions ship. It is older than Vista's: it has no_lfunctions (_strtod_l,_snprintf_l, ...), no_create_localeand no_sfunctions such aswcrtomb_s, and the 2000 one lacks a few XP additions.check-imports.py --nt 5.0(or5.1) checks eachmsvcrt.dllimport against the version that first shipped it (msvcrt-versions.txt, made from mingw-w64's annotated list withgen-msvcrt-versions.py), and each kernel32 import against a list of functions added in XP, Server 2003, Vista and 7 (SRW locks, condition variables,InitOnce,Fls*,GetThreadId,GetTickCount64,GetActiveProcessorCount, ...). - Use
i586(Pentium) triples: 2000 and XP run on a Pentium, andi686code has CMOV, which a Pentium MMX or K6 lacks. As for 9x, there is no SSE unless-marchasks for it. __threadandthread_localuse emulated TLS, as with GCC: the clang in clang-dos/llvm uses it by default for MinGW triples below 6.0, since before Vista Windows sets up native TLS only for the program and the DLLs loaded with it, not for one loaded withLoadLibrary.-fno-emulated-tlsturns it off.build-cxx.shadds a static libc++, libc++abi and libunwind (DWARF unwinding). With the sysroot's_WIN32_WINNTbelow 0x0600, the libc++ in clang-dos/llvm uses no Vista functions:- threads:
std::mutexis aCRITICAL_SECTIONandstd::condition_variablea queue of waiting threads with an event each;call_onceis an interlocked flag; thread-specific data usesTlsAllocwith destructors run from the mingw-w64 runtime's thread exit callback;std::thread::get_idusesNtQueryInformationThreadwhen there is noGetThreadId;atomic::waitpolls. - locales: a locale is its name, set with
setlocalefor each call that takes one. The "C" locale costs asetlocale(LC_ALL, NULL)per call. A named locale changes the process locale for the call, so formatting with a non-"C" locale in two threads at once can race. <filesystem>: file information comes fromNtQueryInformationFile. Windows before Vista has no symbolic links to files, socreate_symlinkfails with an error andcanonicaldoes not resolve junctions.- Windows 2000 needs Service Pack 4 for
msvcrt.dll's_get_heap_handle, which XP has only from SP2; nothing in the sysroot imports it. - Wine runs the tests reporting Windows 2000 or XP, but Wine does not limit
programs to that API, and no real 2000 or XP machine has run them yet.
--dllswith DLLs copied from a real system checks every import.