[PATCH] D93351: [llvm-shlib] Build backend libraries as loadable modules

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 15:21:43 PST 2020


tstellar created this revision.
tstellar added reviewers: serge-sans-paille, mgorny, sylvestre.ledru, beanz, smeenai.
Herald added subscribers: luismarques, steven.zhang, pengfei, s.egerton, lenary, PkmX, atanasyan, sunfish, simoncook, fedor.sergeev, kristof.beyls, arichardson, tpr, sdardis, dylanmckay, jyknight, dschuff.
tstellar requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

Do not include the LLVM backend libraries in libLLVM.so, but instead
build them as modules that can be dlopen'd at runtime.  This helps keeps
the memory footprint of libLLVM.so smaller, since in most cases there
is only 1 backend in use at any time.

I chose not to add a CMake option to enable/disable this feature,
because I don't want to add another set of configuration permutations
that we need to support.

Binary size comparison:

Without Backend Modules:

117M libLLVM-12git.so

With Backend Modules:

60M  libLLVM-12git.so
14M  LLVMAMDGPUBackend.so
12M  LLVMX86Backend.so
8.5M LLVMAArch64Backend.so
7.2M LLVMARMBackend.so
6.7M LLVMHexagonBackend.so
3.6M LLVMPowerPCBackend.so
3.6M LLVMMipsBackend.so
2.2M LLVMSystemZBackend.so
2.1M LLVMNVPTXBackend.so
2.0M LLVMRISCVBackend.so
1.8M LLVMWebAssemblyBackend.so
881K LLVMSparcBackend.so
732K LLVMBPFBackend.so
730K LLVMAVRBackend.so
721K LLVMLanaiBackend.so
704K LLVMXCoreBackend.so

579K LLVMMSP430Backend.so
-------------------------

126M  Total


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93351

Files:
  llvm/tools/llvm-shlib/CMakeLists.txt
  llvm/tools/llvm-shlib/libllvm.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93351.312054.patch
Type: text/x-patch
Size: 3830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201215/b3980e46/attachment.bin>


More information about the llvm-commits mailing list