Hi,
This patch series includes most required changes to build Wine with llvm-mingw:
https://github.com/mstorsjo/llvm-mingw
On top of upstream llvm-mingw, the attached patch is needed. Related changes not covered by this patch series are:
- We need trunk version of LLVM/clang
Martin has made a few changes to LLVM (mostly LLD linker) that are required by Wine. The attached patch changes scripts to use recent enough versions. This will not be needed once they are in stable version.
- libgcc should not be hardcoded
Compiler may use different library for its builtins and llvm-mingw does that. It uses compiler_rt. We should probably run $CC --print-libgcc-file-name inside winebuild instead of hardcoding -lgcc. It shouldn't be too hard, but I didn't look at it yet. The attached patch changes toolchain to provide a symlink as a temporary workaround.
- We need to support MSVC-style delay imports
I currently use this patch:
https://source.winehq.org/patches/data/167998
Martin added a bit nicer option to recent LLD, so we could just use -delayload without -Xlink now. I also have some ideas about moving the logic to winegcc/winebuild instead of configure/makedep, but I don't have patch ready yet.
- You need to pass CROSSCFLAGS=-fno-builtin-exp2 to configure.
Compiler is free to optimize pow(2, x) to exp2(x) and clang does that. exp2, however, is not exposed by most msvcrt versions and it's not as easy to workaround as other functions from mathf.c. Since we will need in-tree implementation of exp2 to migrate crt DLLs to PE files anyway, it should be straightforward to include that in static lib.
That said, simple instructions to test it are:
1. clone llvm-mingw git
2. patch it with the attached patch
3. From there, run ./build-all.sh /install/path
4. Add /install/path/bin to PATH
5. Configure Wine as usually, with additional CROSSCFLAGS=-fno-builtin-exp2 option
I tested x86 and x86_64 builds, but I'd expect arm and aarch64 to mostly work as well.
Cheers,
Jacek