$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
安裝步驟
下載套件
123
git clone http://sourceware.org/git/glibc.git
cd glibc
git checkout --track origin/release/2.27
在新的目錄編譯 glibc,你可以自行指定安裝路徑,一定要指定安裝路徑,以免發生嚴重悲劇。
本次設定主要是針對除錯最佳化,以及避免覆蓋系統原本的 glibc
12345678910111213
cd ../
mkdir out
mkdir rootfs
cd out
# 設定
CFLAGS=-Og CPPFLAGS=-Og CXXFLAGS=-Og ../glibc/configure --disable-werror --prefix=/tmp/rootfs/
# 編譯
make
# 安裝
make install
$ nm Scrt1.o
0000000000000000 D __data_start
0000000000000000 W data_start
U _GLOBAL_OFFSET_TABLE_
0000000000000000 R _IO_stdin_used
U __libc_csu_fini
U __libc_csu_init
U __libc_start_main
U main
0000000000000000 T _start
$ nm libc.a | grep "^printf.o:" -A 10
printf.o:
0000000000000000 T _IO_printf
0000000000000000 T printf
0000000000000000 T __printf
U stdout
U __vfprintf_internal
snprintf.o:
0000000000000000 W snprintf
0000000000000000 T __snprintf
U __vsnprintf_internal
libm.*: 一樣看symbol節錄
123456789101112131415161718192021222324252627
$ nm libm.so.6 |grep " sin"
000000000002eb24 i sin
0000000000034532 W sincos
00000000000419cc i sincosf
0000000000054f26 W sincosf128
00000000000419cc i sincosf32
0000000000034532 W sincosf32x
0000000000034532 W sincosf64
00000000000175c8 W sincosf64x
00000000000175c8 W sincosl
000000000004131e i sinf
0000000000054148 W sinf128
000000000004131e i sinf32
000000000002eb24 i sinf32x
000000000002eb24 i sinf64
0000000000016ead W sinf64x
000000000000ed11 W sinh
000000000001205d W sinhf
0000000000060407 W sinhf128
000000000001205d W sinhf32
000000000000ed11 W sinhf32x
000000000000ed11 W sinhf64
000000000000d9a4 W sinhf64x
000000000000d9a4 W sinhl
0000000000016ead W sinl
00000000000144b5 t sin_pi
0000000000027776 t sin_pi