[klibc] building debug version of klibc

Sam Ravnborg sam at ravnborg.org
Sat Dec 30 03:30:02 PST 2017

Hi Anatoly

On Sat, Dec 30, 2017 at 01:54:05PM +0300, Anatoly Pugachev wrote:
> Hello!
> Can someone please help me in building debug version of klibc ?
> I've cloned git://git.kernel.org/pub/scm/libs/klibc/klibc.git  , but
> failed to build it with debug info
> added "-g" to HOSTCFLAGS in Makefile, but

HOSTCFLAGS is used when building tools running on your build machine.

Try something like this (untested, whitespace damaged):

diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index f500d535..3e8124f7 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -69,7 +69,7 @@ include $(srctree)/scripts/Kbuild.include
 KLIBCREQFLAGS     := $(call cc-option, -fno-stack-protector, ) \
                      $(call cc-option, -fwrapv, )
 KLIBCWARNFLAGS    := -W -Wall -Wno-sign-compare -Wno-unused-parameter

If you use make V=1 then you should be able to see the
full gcc command line, where -g should be included with
theabove fix.


More information about the klibc mailing list