building debug version of klibc

Anatoly Pugachev matorola at gmail.com
Sat Dec 30 05:54:05 EST 2017


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

$ make -j KLIBCKERNELSRC=`pwd`/../linux-2.6/usr

still strips every debug symbol , and i'm failed to change
scripts/Kbuild.klibc and Makefile to remove strip usage

klibc$ find . -name fstype | xargs file
./usr/kinit/fstype:               directory
./usr/kinit/fstype/static/fstype: ELF 64-bit MSB executable, SPARC V9,
relaxed memory ordering, version 1 (SYSV), statically linked, stripped
./usr/kinit/fstype/shared/fstype: ELF 64-bit MSB executable, SPARC V9,
relaxed memory ordering, version 1 (SYSV), statically linked,
interpreter /lib/klibc-M67ne2AU3wnuYln_9h2L1vfH5J0.so, stripped



I started to get segfault in fstype:

linux-2.6$ make install
...
  DEPMOD  4.15.0-rc5-00149-g5aa90a845892
sh ./arch/sparc/boot/install.sh 4.15.0-rc5-00149-g5aa90a845892
arch/sparc/boot/zImage \
        System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal
4.15.0-rc5-00149-g5aa90a845892
/boot/vmlinuz-4.15.0-rc5-00149-g5aa90a845892
run-parts: executing /etc/kernel/postinst.d/initramfs-tools
4.15.0-rc5-00149-g5aa90a845892
/boot/vmlinuz-4.15.0-rc5-00149-g5aa90a845892
update-initramfs: Generating /boot/initrd.img-4.15.0-rc5-00149-g5aa90a845892
Segmentation fault
run-parts: executing /etc/kernel/postinst.d/zz-update-grub
4.15.0-rc5-00149-g5aa90a845892
/boot/vmlinuz-4.15.0-rc5-00149-g5aa90a845892

Dec 30 12:51:06 ttip kernel: fstype[162686]: segfault at 38 ip
000000008001069c (rpc 0000000080004820) sp 000007feffdf53a1 error 1 in
klibc-g_9mplOvk_73CeIA8YN-t9vhxyc.so[80000000+14000]

linux-2.6$ gdb -q -c core.164896
[New LWP 164896]
Core was generated by `/usr/lib/klibc/bin/fstype /dev/vdiska2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000008001069c in ?? ()

linux-2.6$ $ find /usr -name fstype | xargs file
/usr/lib/klibc/bin/fstype: ELF 64-bit MSB executable, SPARC V9,
relaxed memory ordering, version 1 (SYSV), statically linked,
interpreter /lib/klibc-g_9mplOvk_73CeIA8YN-t9vhxyc.so, stripped

linux-2.6# file -s /dev/vdiska2
/dev/vdiska2: Linux rev 1.0 ext4 filesystem data,
UUID=f2eda779-5310-4af2-b48a-b43db51c0961 (needs journal recovery)
(extents) (64bit) (large files) (huge files)

$ dpkg -S /usr/lib/klibc/bin/fstype
klibc-utils: /usr/lib/klibc/bin/fstype

$ dpkg -l klibc-utils
||/ Name                               Version
Architecture           Description
+++-==================================-======================-======================-=========================================================================
ii  klibc-utils                        2.0.4-10               sparc64
              small utilities built with klibc for early boot


$ apt show klibc-utils
Package: klibc-utils
Version: 2.0.4-10
Priority: optional
Section: libs
Source: klibc
Maintainer: maximilian attems <maks at debian.org>
Installed-Size: 522 kB
Depends: libklibc (= 2.0.4-10)
Breaks: initramfs-tools (<< 0.123~)
Homepage: https://git.kernel.org/cgit/libs/klibc/klibc.git
Download-Size: 107 kB
APT-Manual-Installed: no
APT-Sources: http://ftp.ports.debian.org/debian-ports unstable/main
sparc64 Packages
Description: small utilities built with klibc for early boot
 This package contains a collection of programs that are linked
 against klibc. These duplicate some of the functionality of a
 regular Linux toolset, but are typically much smaller than their
 full-function counterparts.  They are intended for inclusion in
 initramfs images and embedded systems.



More information about the Kernelnewbies mailing list