diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf index d55ecea6dc4a9..86287c3a25a3c 100644 --- a/Configurations/00-base-templates.conf +++ b/Configurations/00-base-templates.conf @@ -78,6 +78,7 @@ my %targets=( AR => "ar", ARFLAGS => "qc", CC => "cc", + OBJCOPY => "objcopy", bin_cflags => sub { my @flags = (); diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 4c24cae7ab62e..966d8fec89848 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -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) diff --git a/Configure b/Configure index a6b66df4c4d1c..fff97bd6fc820 100755 --- a/Configure +++ b/Configure @@ -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 diff --git a/INSTALL.md b/INSTALL.md index c25bec822500d..63ca4e37a5dc3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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.