[klibc] [klibc:master] Kbuild: Add option to install unstripped binaries

klibc-bot for Ben Hutchings ben at decadent.org.uk
Sat Jan 19 16:24:04 PST 2019


Commit-ID:  908fca5066fa8e8934df21cbde84b8eccab8a5c9
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=908fca5066fa8e8934df21cbde84b8eccab8a5c9
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Sat, 19 Jan 2019 23:19:38 +0000
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sun, 20 Jan 2019 00:14:40 +0000

[klibc] Kbuild: Add option to install unstripped binaries

The .deb and RPM packaging tools can automatically split
debugging symbols into a separate package.  This requires
that binaries and shared libaries are initially installed
unstripped, and that they are given build IDs.

If CONFIG_DEBUG_INFO is defined:

* Add --build-id=sha1 to the linker options
* Don't strip binaries after linking them

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 defconfig            | 1 +
 scripts/Kbuild.klibc | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/defconfig b/defconfig
index 04b98e9..9938e0a 100644
--- a/defconfig
+++ b/defconfig
@@ -7,3 +7,4 @@ CONFIG_REGPARM=y
 # ARM options
 # CONFIG_KLIBC_THUMB is not set
 # CONFIG_AEABI is not set
+# CONFIG_DEBUG_INFO is not set
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 7a8ad2a..5a4b71e 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -100,7 +100,7 @@ KLIBCAR          := $(AR)
 klibc-ar = $(KLIBCAR) $(if $(KBUILD_REPRODUCIBLE),$(2),$(1))
 
 KLIBCRANLIB      := $(call klibc-ar,s,Ds)
-KLIBCSTRIP       := $(STRIP)
+KLIBCSTRIP       := $(if $(CONFIG_DEBUG_INFO),true,$(STRIP))
 KLIBCNM          := $(NM)
 KLIBCOBJCOPY     := $(OBJCOPY)
 KLIBCOBJDUMP     := $(OBJDUMP)
@@ -136,6 +136,10 @@ KLIBCLIBCSHARED  := $(KLIBCOBJ)/libc.so
 # How to tell the linker main() is the entrypoint
 KLIBCEMAIN	 ?= -e main
 
+ifdef CONFIG_DEBUG_INFO
+KLIBCLDFLAGS     += --build-id=sha1
+endif
+
 #
 # This indicates the location of the final version of the shared library.
 # THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH.


More information about the klibc mailing list