[PATCH] D35077: [RFC] Build LLVM-C.dll on MSVC that exports only the C API

Jakob Bornecrantz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 11:15:32 PDT 2017


Wallbraker created this revision.
Herald added a subscriber: mgorny.

Hello!

This commit adds a LLVM-C target that is always built on MSVC. A big fat warning, this is my first cmake code ever so there is a fair bit of I-have-no-idea-what-I'm-doing going on here. Which is also why I placed it outside of llvm-shlib as I was afraid of breaking things of other people. Secondly llvm-shlib builds a LLVM.so which exports all symbols and then does a thin library that points to it, but on Windows we do not build a LLVM.dll so that would have complicated the code more.

The patch includes a python script that calls dumpbin.exe to get all of the symbols from the built libraries. It then grabs all the symbols starting with LLVM and generates the export file from those. The export file is then used to create the library just like the LLVM-C that is built on darwin.

Improvements that I need help with:

- Get cmake to make sure that dumpbin.exe is on the path and wire the full path to the script.
- Use LLVM-C.dll when building llvm-c-test so we can verify that the symbols are exported.
- Bundle the LLVM-C.dll with the windows installer.

Why do this?  I'm building a language frontend which is self-hosting, and on windows because of various tooling issues we have a problem of consuming the LLVM*.lib directly on windows. Me and the users of my projects using LLVM would be greatly helped by having LLVM-C.dll built and shipped by the Windows installer. Not only does LLVM takes forever to build, you have to run a extra python script in order to get the final DLL.

Any comments, thoughts or help is greatly appreciated.

Cheers, Jakob.


https://reviews.llvm.org/D35077

Files:
  tools/llvm-c-dll/CMakeLists.txt
  tools/llvm-c-dll/gen-msvc-exports.py
  tools/llvm-c-dll/llvm-c.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35077.105480.patch
Type: text/x-patch
Size: 5175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/db7f20c2/attachment.bin>


More information about the llvm-commits mailing list