Skip to content

Checks and tests

What does not work

  • PE TLS callbacks never run on 9x. __thread variables work in an EXE; with clang-dos/llvm's default of emulated TLS for versions before 6.0 they work in DLLs too. C++ thread_local destructors do not run on 9x.

Checking imports

check-imports.py lists the functions a program imports that Windows 9x lacks or has only as Unicode stubs. Without DLLs it uses a built-in list of NT-only and newer functions. With --dlls DIR, where DIR holds one directory of system DLLs per Windows version (for example 95osr2/ and 98se/ with KERNEL32.DLL, USER32.DLL, GDI32.DLL, ADVAPI32.DLL and MSVCRT.DLL copied from those systems), it checks every import against the real export tables.

python3 tools/check-imports.py --dlls ~/win9x-dlls hello.exe

Tests

BIN=~/llvm/build/bin SYSROOT=~/win9x-sysroot DLLS=~/win9x-dlls \
  sh tests/run-tests.sh

(TARGETS="i586-pc-windows5.0-gnu i586-pc-windows5.1-gnu" with a 2000/XP sysroot, TARGETS="i386-pc-windows3.10-gnu i386-pc-windows3.51-gnu i386-pc-windows4.0-gnu" with the crtdll one) builds tests/hello.c, tests/libc.c, tests/tchar.c (a native ANSI build of generic-text code), tests/gui.c and, when the sysroot has libunicows, tests/unicode.c (a Unicode build with unicows) for 95, 98 and ME at -O0, -O2 and -Os, checks their imports and runs the console tests under Wine when it is installed, with Wine reporting each target's Windows version. When the sysroot has libc++, it also builds tests/cxx.cpp (iostreams, numbers through the C locale, exceptions, RTTI), tests/threads.cpp (mutexes, condition variables, call_once, thread IDs, thread_local destructors, futures, atomic::wait), tests/fs.cpp (<filesystem>) and tests/tlsmain.cpp, which loads tests/tlsdll.cpp with LoadLibrary and uses its thread_local variables from several threads, and checks that the import checker rejects a Vista kernel32 function and a Vista msvcrt.dll one. Wine does not limit programs to the 9x API, so a real Windows 9x machine is still the final test.