Skip to content

Commit

Permalink
Add ids paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
fsfod authored and asl committed Dec 16, 2024
1 parent 1cc3d59 commit 631ad44
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions content/posts/2024-11-23-gsoc-windows-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ In order to support DLL builds on MinGW, a [python script](https://github.com/ll
## What We Did
Some initial work I did was update the LLVM CMake build system to be able to build a LLVM DLL and use clang-cl's [/Zc:dllexportInlines-](https://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html). Inline declared class methods by default are not compiled unless used, but when the `__declspec(dllexport)` attribute is applied to a class all its methods are compiled and exported by the compiler even if not used. This option negates this behaviour, preventing inline methods from being compiled and exported. This avoids emitting these methods in every translation unit including the declaration, greatly reducing compile times for DLL builds. More importantly, it almost halves the number of symbols exported for LLVM to 28k and Clang DLL to 20k. The cost of this improvement is that DLLs built with this option cannot be consumed by code being built with MSVC as that code expects these methods to be available externally. There is a Microsoft Developer Community [issue](https://developercommunity.visualstudio.com/t/implement-zcdllexportinlines-aka-fvisibility-inlin/374754) to add it to MSVC, please consider voting for it so that it may be considered by Microsoft for addition to the MSVC toolchain.

Another major thing I worked on was extending a Clang tooling based tool [ids](https://github.com/compnerd/ids) that Saleem Abdulrasool created to automate adding symbol visibility macros to classes, global functions and variables in public LLVM and Clang headers. I made its file processing multi-threaded and added a config file system to make it simple to add exclusions for different headers and directories when adding macro annotations. I also changed it to automatically add a include the header that defines the visibility macros when code is annotated by macros in a file.

I managed to get plugins for Clang and LLVM working including passing the LLVM and Clang test suite when building with clang-cl. Some of the changes to support this have already merged LLVM and Clang or are waiting in open PRs, but it will take some time to get all the changes merged across the whole LLVM and Clang codebase.
The greatly reduced install size from using a non statically linked build of LLVM tools and Clang could also help with [current limitation](https://github.com/llvm/llvm-project/issues/101994) of the installer used for the official distribution on windows that forced the number of targets included in the official distribution to be limited. It would shrink from over 2GB to close to 500MB.

Expand Down

0 comments on commit 631ad44

Please sign in to comment.