[Lldb-commits] [PATCH] D61473: ExpressionParser: only force link MCJIT when needed

Saleem Abdulrasool via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 2 17:07:48 PDT 2019


compnerd created this revision.
compnerd added reviewers: labath, clayborg, emaste, davide, xiaobai.
Herald added subscribers: teemperor, abidh, krytarowski, mgorny.
Herald added a project: LLDB.

This was added to support FreeBSD.  The inclusion of this header increases the
size of `lldb-server` due to MCJIT being forcefully preserved.  Conditionalise
the inclusion to shared builds of LLVM which will allow for MCJIT to be stripped
if unnecessary when performing static linking of tools.  This shaves off ~28% of
the binary size for lldb-server when linked with gold using
`-ffunction-sections` and `-fdata-sections`.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61473

Files:
  source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -41,10 +41,12 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetSelect.h"

+#if defined(LLDB_FORCE_LINK_MCJIT)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wglobal-constructors"
 #include "llvm/ExecutionEngine/MCJIT.h"
 #pragma clang diagnostic pop
+#endif

 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
Index: source/Plugins/ExpressionParser/Clang/CMakeLists.txt
===================================================================
--- source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -50,3 +50,7 @@
     MCJIT
     Support
   )
+if(LLVM_LINK_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS)
+  target_compile_definitions(lldbPluginExpressionParserClang PRIVATE
+    LLDB_FORCE_LINK_MCJIT)
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61473.197895.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190503/34098074/attachment.bin>


More information about the lldb-commits mailing list