[cfe-dev] [GSoC] "Microsoft Visual C++ ABI support in Clang" proposal

Charles Davis cdavis at mymail.mines.edu
Mon Mar 28 18:22:39 PDT 2011


Here's one of my proposals for this year's Google Summer of Code. (The
other is on LLVMdev.)

Title: Microsoft Visual C++ ABI support in Clang

Abstract:

Both GCC and Clang default to using the Itanium C++ ABI. However, the de
facto standard C++ ABI on Windows is the one provided by Microsoft in
their Visual C++ product. If Clang could generate code against the
Microsoft Visual C++ ABI, it would be more compatible with C++ libraries
that were built with Visual C++. This should also ease development of
C++ DLLs for use with Wine (http://www.winehq.org).

Content:

1. Proposal

Currently, both GCC and Clang default to generating C++ code against the
so-called Itanium C++ ABI. This is fine for Unix, where there is no real
standard, but is a problem on Windows. There, the de facto standard is
the ABI provided by Microsoft in their Visual C++ product. Most people
on Windows use Visual C++--in part, because the compiler itself is
available for no charge from Microsoft--and, as a result, many other
compilers for Windows support to some extent the Microsoft Visual C++
ABI. This ABI is, in fact, integrated into Windows itself: several
system libraries are built against it.

It is therefore imperative that Clang on Windows support the Microsoft
Visual C++ ABI. By supporting this de facto standard, Clang could
improve its compatibility with many C++ libraries built on Windows.

In this project, I will implement enough of the Visual C++ ABI to get
simple programs working, such as the C++ "Hello, world" program. If time
permits, which I admit it likely will, I will implement additional
features. Features covered by the scope of this project include
everything outside of exception handling, including name mangling
(already partially implemented), class layout, vtable layout, calls to
virtual functions, and accesses of members in virtual bases. Proper EH
support requires SEH support and is thus beyond the scope of this project.

This would not just benefit Windows users. This support could
potentially be used in combination with Wine (http://www.winehq.org) to
ease the porting and/or development of DLLs written in C++ to Wine.

2. Interest

My interest is primarily in the second benefit (to Wine), since I do not
primarily run Windows. However, I realize that my work in this area
would benefit the many Windows users we now have, as well.

3. Usefulness to LLVM

By adding support for the Microsoft Visual C++ ABI, Clang could expand
its user-base, particularly on Windows, where this ABI is prevalent.
Clang would also become more compatible with a vast collection of
software libraries that were built against VC++.

4. Prior knowledge in compilers and LLVM in particular

Last year's project involved laying out the necessary support for this.
I have been working with LLVM since the fall of 2009. I am familiar with
Clang and its inner workings, and have added several new features to
Clang since I started working with it (such as forced stack alignment,
GNU-compatible extern inline, and of course, extensible C++ ABI support).

5. Academic, industry, etc. experience

I am a student at the Colorado School of Mines studying in Computer
Science. I am a Senior by year and credits, and I am set to graduate in
December of 2011. In addition, I have contributed to several open-source
projects, including Wine and LLVM.

6. Contact information

 - E-mail: cdavis at mymail.mines.edu
 - IRC nick: cdavis5x

Chip



More information about the cfe-dev mailing list