Skip to content

Commit

Permalink
Add debuginfo build target
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#25174)
  • Loading branch information
nhorman authored and t8m committed Aug 21, 2024
1 parent 55662b6 commit a5d5662
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Configurations/00-base-templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ my %targets=(
AR => "ar",
ARFLAGS => "qc",
CC => "cc",
OBJCOPY => "objcopy",
bin_cflags =>
sub {
my @flags = ();
Expand Down
6 changes: 6 additions & 0 deletions Configurations/unix-Makefile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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} -}

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a5d5662

Please sign in to comment.