Page MenuHomeFreeBSD

src.conf: Add WITH_LLVM_STATIC build knob
Needs ReviewPublic

Authored by dim on Fri, Jun 20, 5:22 PM.
Tags
None
Referenced Files
F121989250: D50956.diff
Tue, Jul 1, 5:54 AM
F121961824: D50956.id157391.diff
Tue, Jul 1, 12:45 AM
F121922360: D50956.id157397.diff
Mon, Jun 30, 4:35 PM
F121883281: D50956.diff
Mon, Jun 30, 7:47 AM
Unknown Object (File)
Mon, Jun 30, 1:28 AM
Unknown Object (File)
Sun, Jun 29, 3:26 PM
Unknown Object (File)
Wed, Jun 25, 10:02 AM
Unknown Object (File)
Tue, Jun 24, 10:02 AM

Details

Summary

In commit 2e47f35be5dc libllvm, libclang and liblldb were converted into
private shared libraries. This allowed clang, lld, lldb, and other llvm
tools to be linked against these shared libraries, which makes them
smaller and avoids duplication.

However, this also comes at the cost of some performance, since the
dynamic libraries are quite large, and contain lots of long symbols
(mangled C++ identifiers).

Add a WITH_LLVM_STATIC build knob that can be used to go back to the
previous behavior: libllvm, libclang and liblldb are built as internal
static libraries, i.e. only available during buildworld, and fully
linked into the various executables such as clang, lld, etc.

PR: 287447
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 65120
Build 62003: arc lint + arc unit

Event Timeline

dim requested review of this revision.Fri, Jun 20, 5:22 PM

Also include src.opts.mk in libllvm's and liblldb's Makefiles, otherwise
MK_ variables might not be defined.

IMO we should expand on the user-facing effect in the option descriptions - i.e., for WITH_LLVM_STATIC the Clang/LLVM toolchain binaries will be much larger but start more quickly. WITHOUT_LLVM_STATIC the Clang/LLVM binaries will be smaller, but will take longer to start.

lib/clang/liblldb/Makefile
4

Makes sense for consistency but I assume we don't actually build liblldb as a cross-tool?

IMO we should expand on the user-facing effect in the option descriptions - i.e., for WITH_LLVM_STATIC the Clang/LLVM toolchain binaries will be much larger but start more quickly. WITHOUT_LLVM_STATIC the Clang/LLVM binaries will be smaller, but will take longer to start.

I looked at a few other WITH/WITHOUT descriptions and they're usually rather terse, but you're probably right. Better to to explicit about the purpose of the knob.

lib/clang/liblldb/Makefile
4

Makes sense for consistency but I assume we don't actually build liblldb as a cross-tool?

You're right, this is a copy/pasted pair of lines from the other two Makefiles. TOOLS_PREFIX is only defined when bootstrapping the compiler, and indeed we never build lldb during that phase.

  • Adjust comment in liblldb Makefile
  • Expand descriptions in WITH/WITHOUT fragments

Btw there is still one rather nasty fly in the ointment for this patch: in tools/build/depend-cleanup.sh we have a hack to delete libllvm.a, libclang.a and liblldb.a from the obj tree. I don't know of a way to get at the MK_LLVM_STATIC option value in that shell script though. Does anybody have any good idea for that? Run ${MAKE} in some form that spits out the value?

Add hack to ensure depend-cleanup.sh does not inadvertently delete static llvm/clang etc libraries.