Skip to content

Instantly share code, notes, and snippets.

@mmarchini
Created November 27, 2019 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarchini/b358667cd2365bfc8199cc27943c741b to your computer and use it in GitHub Desktop.
Save mmarchini/b358667cd2365bfc8199cc27943c741b to your computer and use it in GitHub Desktop.
Building libc6 with frame pointers
# Uncomment deb-src lines on /etc/apt/sources.list
sudo apt-get update
# Or replace ~/glibc with preferred path to store libc source
mkdir -p ~/glibc
cd ~/glibc
sudo apt-get install -y dpkg-dev
sudo apt-get build-deps libc6
apt-get source libc6
cd glibc-*
mkdir build
cd build
CFLAGS="-O1 -fno-omit-frame-pointer" ../configure --prefix=/usr/local/libc-fp --disable-werror
make -j8
# emits: libc.so, nptl/libpthread.so, rt/librt.so, math/libm.so, resolv/libresolv.so
make install
# Change 2.29 with your libc version
LD_PRELOAD="/usr/local/libc-fp/lib/libc-2.29.so /usr/local/libc-fp/lib/libpthread-2.29.so"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment