Skip to content

Commit

Permalink
[EVM] Add lld config to llvm-config.
Browse files Browse the repository at this point in the history
HACK: It seems llvm-config is not supposed for lld
by design. At the same time, we need lld support in llvm-config
because 'inkwell' package gatheres the linking info via it.
This is rather a temporary workaround.
  • Loading branch information
PavelKopyl committed Apr 26, 2024
1 parent f6dbaa9 commit f443a5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions llvm/cmake/modules/LLVM-Build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function(LLVMBuildGenerateCFragment)
endforeach()

list(LENGTH llvmbuild_components llvmbuild_components_size)
math(EXPR components_size "${llvmbuild_components_size} + 4")
file(WRITE ${ARG_OUTPUT}
"
struct AvailableComponent {
Expand All @@ -30,8 +31,8 @@ function(LLVMBuildGenerateCFragment)
bool IsInstalled;
/// The list of libraries required when linking this component.
const char *RequiredLibraries[${llvmbuild_components_size}];
} AvailableComponents[${llvmbuild_components_size}] = {
const char *RequiredLibraries[${components_size}];
} AvailableComponents[${components_size}] = {
")

foreach(llvmbuild_component ${llvmbuild_components})
Expand Down Expand Up @@ -73,6 +74,10 @@ function(LLVMBuildGenerateCFragment)
foreach(llvmbuild_centry ${llvmbuild_centries})
file(APPEND ${ARG_OUTPUT} "${llvmbuild_centry}")
endforeach()
file(APPEND ${ARG_OUTPUT} "{ \"lldcommon\", \"lldCommon\", true, {} },\n")
file(APPEND ${ARG_OUTPUT} "{ \"lldelf\", \"lldELF\", true, {} },\n")
file(APPEND ${ARG_OUTPUT} "{ \"lldc\", \"lldC\", true, {} },\n")
file(APPEND ${ARG_OUTPUT} "{ \"lld\", nullptr, true, {\"lldcommon\", \"lldelf\", \"lldc\"} },\n")
file(APPEND ${ARG_OUTPUT} "};")
endfunction()

Expand Down
10 changes: 7 additions & 3 deletions llvm/utils/gn/build/write_library_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
bool IsInstalled;
/// The list of libraries required when linking this component.
const char *RequiredLibraries[84];
} AvailableComponents[84] = {
const char *RequiredLibraries[88];
} AvailableComponents[88] = {
{ "aggressiveinstcombine", "LLVMAggressiveInstCombine", true, {"analysis", "core", "support", "transformutils"} },
{ "all", nullptr, true, {"demangle", "support", "tablegen", "core", "fuzzmutate", "filecheck", "interfacestub", "irreader", "codegen", "selectiondag", "asmprinter", "mirparser", "globalisel", "binaryformat", "bitreader", "bitwriter", "bitstreamreader", "dwarflinker", "extensions", "frontendopenmp", "transformutils", "instrumentation", "aggressiveinstcombine", "instcombine", "scalaropts", "ipo", "vectorize", "objcarcopts", "coroutines", "cfguard", "linker", "analysis", "lto", "mc", "mcparser", "mcdisassembler", "mca", "object", "objectyaml", "option", "remarks", "debuginfodwarf", "debuginfogsym", "debuginfomsf", "debuginfocodeview", "debuginfopdb", "symbolize", "executionengine", "interpreter", "jitlink", "mcjit", "orcjit", "orcshared", "orctargetprocess", "runtimedyld", "target", "asmparser", "lineeditor", "profiledata", "coverage", "passes", "textapi", "dlltooldriver", "libdriver", "xray", "windowsmanifest"} },
{ "all", nullptr, true, {"demangle", "support", "tablegen", "core", "fuzzmutate", "filecheck", "interfacestub", "irreader", "codegen", "selectiondag", "asmprinter", "mirparser", "globalisel", "binaryformat", "bitreader", "bitwriter", "bitstreamreader", "dwarflinker", "extensions", "frontendopenmp", "transformutils", "instrumentation", "aggressiveinstcombine", "instcombine", "scalaropts", "ipo", "vectorize", "objcarcopts", "coroutines", "cfguard", "linker", "analysis", "lto", "mc", "mcparser", "mcdisassembler", "mca", "object", "objectyaml", "option", "remarks", "debuginfodwarf", "debuginfogsym", "debuginfomsf", "debuginfocodeview", "debuginfopdb", "symbolize", "executionengine", "interpreter", "jitlink", "mcjit", "orcjit", "orcshared", "orctargetprocess", "runtimedyld", "target", "asmparser", "lineeditor", "profiledata", "coverage", "passes", "textapi", "dlltooldriver", "libdriver", "xray", "windowsmanifest", "lld"} },
{ "all-targets", nullptr, true, {} },
{ "analysis", "LLVMAnalysis", true, {"binaryformat", "core", "object", "profiledata", "support"} },
{ "asmparser", "LLVMAsmParser", true, {"binaryformat", "core", "support"} },
Expand Down Expand Up @@ -91,6 +91,10 @@
{ "vectorize", "LLVMVectorize", true, {"analysis", "core", "support", "transformutils"} },
{ "windowsmanifest", "LLVMWindowsManifest", true, {"support"} },
{ "xray", "LLVMXRay", true, {"support", "object"} },
{ "lldcommon", "lldCommon", true, {} },
{ "lldelf", "lldELF", true, {} },
{ "lldc", "lldC", true, {} },
{ "lld", "null", true, {"lldcommon", "lldelf", "lldc"} },
};
"""

Expand Down

0 comments on commit f443a5f

Please sign in to comment.