git: 73ff7384e025 - main - Optionally create full debuginfo for llvm-related executables
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 16 Feb 2024 23:20:30 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=73ff7384e025033abc98fd5437a48beb8077a90b commit 73ff7384e025033abc98fd5437a48beb8077a90b Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-02-11 19:02:51 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-02-16 23:15:32 +0000 Optionally create full debuginfo for llvm-related executables Commit de6feefdb7cfd limited the amount of debuginfo generated for clang and other llvm-related executables. This was done to save disk space and memory during building, but it makes debugging any of these executables much harder. Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate full debuginfo instead. This is off by default, but could for example be enabled for release builds or snapshots, so llvm executables are easier to debug. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43839 --- lib/clang/Makefile.inc | 4 +++- lib/clang/headers/Makefile | 1 + lib/clang/libclang/Makefile | 2 +- lib/clang/libclangminimal/Makefile | 1 + lib/clang/liblldb/Makefile | 1 + lib/clang/libllvm/Makefile | 2 +- lib/clang/libllvmminimal/Makefile | 1 + share/man/man5/src.conf.5 | 5 ++++- share/mk/src.opts.mk | 1 + tools/build/options/WITH_LLVM_FULL_DEBUGINFO | 2 ++ usr.bin/clang/Makefile.inc | 8 +++++--- 11 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/clang/Makefile.inc b/lib/clang/Makefile.inc index 2dfc966726b0..37da7ac759b1 100644 --- a/lib/clang/Makefile.inc +++ b/lib/clang/Makefile.inc @@ -1,13 +1,15 @@ -.include <bsd.compiler.mk> +.include <src.opts.mk> PACKAGE= clang MK_PIE:= no # Explicit libXXX.a references +.if ${MK_LLVM_FULL_DEBUGINFO} == "no" .if ${COMPILER_TYPE} == "clang" DEBUG_FILES_CFLAGS= -gline-tables-only .else DEBUG_FILES_CFLAGS= -g1 .endif +.endif WARNS?= 0 diff --git a/lib/clang/headers/Makefile b/lib/clang/headers/Makefile index 49f78b0a4d97..f72567514f20 100644 --- a/lib/clang/headers/Makefile +++ b/lib/clang/headers/Makefile @@ -1,4 +1,5 @@ +.include <bsd.init.mk> .include "../clang.pre.mk" .PATH: ${CLANG_SRCS}/lib/Headers diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile index 51c209d879f1..8d911905808d 100644 --- a/lib/clang/libclang/Makefile +++ b/lib/clang/libclang/Makefile @@ -1,5 +1,5 @@ -.include <src.opts.mk> +.include <bsd.init.mk> .include "../clang.pre.mk" LIB= clang diff --git a/lib/clang/libclangminimal/Makefile b/lib/clang/libclangminimal/Makefile index 744e1a835f90..22faa7b98aeb 100644 --- a/lib/clang/libclangminimal/Makefile +++ b/lib/clang/libclangminimal/Makefile @@ -1,4 +1,5 @@ +.include <bsd.init.mk> .include "../clang.pre.mk" LIB= clangminimal diff --git a/lib/clang/liblldb/Makefile b/lib/clang/liblldb/Makefile index c32e4a387b2e..e6e1e638abce 100644 --- a/lib/clang/liblldb/Makefile +++ b/lib/clang/liblldb/Makefile @@ -1,4 +1,5 @@ +.include <bsd.init.mk> .include "../lldb.pre.mk" LIB= lldb diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index df39f2eb212e..b59d881ad99a 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -1,5 +1,5 @@ -.include <src.opts.mk> +.include <bsd.init.mk> .include "../llvm.pre.mk" LIB= llvm diff --git a/lib/clang/libllvmminimal/Makefile b/lib/clang/libllvmminimal/Makefile index 83c7101b04f5..ce5535a59072 100644 --- a/lib/clang/libllvmminimal/Makefile +++ b/lib/clang/libllvmminimal/Makefile @@ -1,4 +1,5 @@ +.include <bsd.init.mk> .include "../llvm.pre.mk" LIB= llvmminimal diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index e6affc81ab9c..a32b267afeb4 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd November 13, 2023 +.Dd February 16, 2024 .Dt SRC.CONF 5 .Os .Sh NAME @@ -929,6 +929,9 @@ Do not build the tool. .It Va WITHOUT_LLVM_CXXFILT Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. +.It Va WITH_LLVM_FULL_DEBUGINFO +Generate full debug information for LLVM libraries and tools, which uses +more disk space and build resources, but allows for easier debugging. .It Va WITHOUT_LLVM_TARGET_AARCH64 Do not build LLVM target support for AArch64. The diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index cf7f3f7dffa7..20c98cf45567 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -205,6 +205,7 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ LLVM_BINUTILS \ + LLVM_FULL_DEBUGINFO \ MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ diff --git a/tools/build/options/WITH_LLVM_FULL_DEBUGINFO b/tools/build/options/WITH_LLVM_FULL_DEBUGINFO new file mode 100644 index 000000000000..4362de9eb762 --- /dev/null +++ b/tools/build/options/WITH_LLVM_FULL_DEBUGINFO @@ -0,0 +1,2 @@ +Generate full debug information for LLVM libraries and tools, which uses +more disk space and build resources, but allows for easier debugging. diff --git a/usr.bin/clang/Makefile.inc b/usr.bin/clang/Makefile.inc index 831cd56a8c25..99e993b57cb2 100644 --- a/usr.bin/clang/Makefile.inc +++ b/usr.bin/clang/Makefile.inc @@ -1,14 +1,16 @@ -WARNS?= 0 - -.include <bsd.compiler.mk> +.include <src.opts.mk> MK_PIE:= no # Explicit libXXX.a references +.if ${MK_LLVM_FULL_DEBUGINFO} == "no" .if ${COMPILER_TYPE} == "clang" DEBUG_FILES_CFLAGS= -gline-tables-only .else DEBUG_FILES_CFLAGS= -g1 .endif +.endif + +WARNS?= 0 .include "../Makefile.inc"