aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-01-19 23:19:38 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-01-20 00:14:40 +0000
commit908fca5066fa8e8934df21cbde84b8eccab8a5c9 (patch)
tree1182d5e55aa8e84a9d18f464dd8ee1268375cbd4
parent9ded753aff9439cddd84b0cc469312b6c11823ab (diff)
downloadklibc-908fca5066fa8e8934df21cbde84b8eccab8a5c9.tar.gz
[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@decadent.org.uk>
-rw-r--r--defconfig1
-rw-r--r--scripts/Kbuild.klibc6
2 files changed, 6 insertions, 1 deletions
diff --git a/defconfig b/defconfig
index 04b98e9cf9573..9938e0ab1c4f5 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 7a8ad2ac0f600..5a4b71e7230e4 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.