Clang

Clang

Clang is a compiler front end for the C, C++, and Objective-C programming languages, using the Low Level Virtual Machine (LLVM) as its back end. The goal is to offer a replacement to the GNU Compiler Collection (GCC) software stack.

To compile wine with Clang, use:

#!/bin/bash
export CC=clang
export CXX=clang
export CFLAGS="-std=gnu89 -g"
./configure
make

The following patch forces an aligned stack, which works around some of the bugs:

diff --git a/include/windef.h b/include/windef.h
index 9cf98e7..bc2d82e 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -53,11 +53,7 @@ extern "C" {
 #ifndef __stdcall
 # ifdef __i386__
 #  ifdef __GNUC__
-#   ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
 #    define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
-#   else
-#    define __stdcall __attribute__((__stdcall__))
-#   endif
 #  elif defined(_MSC_VER)
     /* Nothing needs to be done. __stdcall already exists */
 #  else

Known bugs

Bug

Wine bug url

clang bug url

Fixed in version/workaround

No support for .cfi_adjust_cfa_offset, .cfi_rel_offset, .cfi_same_value

n/a

http://llvm.org/bugs/show_bug.cgi?id=9676

r129378 (pre3.0 trunk)

Wine fails to compile at "-O1" (in 2.9/svn)

n/a

http://llvm.org/bugs/show_bug.cgi?id=9693)--

r137292 (pre3.0 trunk)

Wine fails to compile with Clang 2.8 on OSX

http://bugs.winehq.org/show_bug.cgi?id=26357

Clang doesn't fail on unsupported options

http://bugs.winehq.org/show_bug.cgi?id=26751

http://llvm.org/bugs/show_bug.cgi?id=9701

tentative clang patch

comdlg32:finddlg test hangs indefinitely

http://bugs.winehq.org/show_bug.cgi?id=25824

http://llvm.org/bugs/show_bug.cgi?id=9704

Wine's regedit crashes

http://bugs.winehq.org/show_bug.cgi?id=26754

http://llvm.org/bugs/show_bug.cgi?id=9830

stack alignment patch

msvcp90/string test crashes

http://llvm.org/bugs/show_bug.cgi?id=9750

clang version 3.1 (trunk 150446)

msctf/categorymgr.c test crashes

http://bugs.winehq.org/show_bug.cgi?id=25826

http://llvm.org/bugs/show_bug.cgi?id=9705

Wine 1.3.32

shdocvw:ie test crashes

http://bugs.winehq.org/show_bug.cgi?id=25808

http://llvm.org/bugs/show_bug.cgi?id=9702

oleaut32:tmarshal test crashes

http://bugs.winehq.org/show_bug.cgi?id=25828

http://llvm.org/bugs/show_bug.cgi?id=9702

user32:dialog test fails

http://bugs.winehq.org/show_bug.cgi?id=25831

http://llvm.org/bugs/show_bug.cgi?id=9707

wineboot crashes in cabinet.dll

http://bugs.winehq.org/show_bug.cgi?id=26755

http://llvm.org/bugs/show_bug.cgi?id=9844

stack alignment patch

wine segfaults on launch with -O2

http://llvm.org/bugs/show_bug.cgi?id=8561

Can't build wine in 64-bit mode

n/a

http://llvm.org/bugs/show_bug.cgi?id=8851

Clang doesn't support ms_hook_prologue

n/a

http://llvm.org/bugs/show_bug.cgi?id=10212

Dragonegg fails to compiler loader/preloader.c

http://bugs.winehq.org/show_bug.cgi?id=28050

http://llvm.org/bugs/show_bug.cgi?id=11173

Clang doesn't support -no-defaultlibs

n/a

http://llvm.org/bugs/show_bug.cgi?id=11172

See also

Clang (last edited 2012-02-14 06:12:33 by AustinEnglish)