Add debuginfo build target

In the webinar we are currently producing on debugging openssl
applications, we talk about ways to allow debugable binaries without
having to ship all the debug DWARF information to production systems.

Add an optional target to do that DWARF separation to aid users

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25174)
This commit is contained in:
Neil Horman 2024-08-13 15:16:08 -04:00 committed by Tomas Mraz
parent 55662b6745
commit a5d56626b9
4 changed files with 14 additions and 0 deletions

View file

@ -78,6 +78,7 @@ my %targets=(
AR => "ar",
ARFLAGS => "qc",
CC => "cc",
OBJCOPY => "objcopy",
bin_cflags =>
sub {
my @flags = ();

View file

@ -373,6 +373,7 @@ CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
OBJCOPY={- $config{OBJCOPY} -}
MAKEDEPEND={- $config{makedepcmd} -}
@ -533,6 +534,11 @@ LANG=C
{- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep
all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation
debuginfo: $(SHLIBS)
@set -e; for i in $(SHLIBS); do \
$(OBJCOPY) --only-keep-debug $$i $$i.debug; \
$(OBJCOPY) --strip-debug --add-gnu-debuglink=$$i.debug $$i; \
done;
##@ Documentation
build_generated_pods: $(GENERATED_PODS)

View file

@ -758,6 +758,7 @@ my %user = (
RANLIB => env('RANLIB'),
RC => env('RC') || env('WINDRES'),
RCFLAGS => [ env('RCFLAGS') || () ],
OBJCOPY => undef,
RM => undef,
);
# Info about what "make variables" may be prefixed with the cross compiler

View file

@ -1676,6 +1676,12 @@ described here. Examine the Makefiles themselves for the full list.
build_docs
Build all documentation components.
debuginfo
On unix platforms, this target can be used to create .debug
libraries, which separate the DWARF information in the
shared library ELF files into a separate file for use
in post-mortem (core dump) debugging
clean
Remove all build artefacts and return the directory to a "clean"
state.