-
-
Save nbulischeck/bda4397a59b77822703f98f6aeb2cb20 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# Install Dependencies | |
sudo pacman -S git svn gd lib32-gcc-libs patch make bison fakeroot | |
# Checkout glibc source | |
svn checkout --depth=empty svn://svn.archlinux.org/packages | |
cd packages | |
svn update glibc | |
cd glibc/repos/core-x86_64 | |
# Add current locale to locale.gen.txt | |
grep -v "#" /etc/locale.gen >> locale.gen.txt | |
# Enable debug build in PKGBUILD | |
sed -i 's#!strip#debug#' PKGBUILD | |
# Build glibc and glibc-debug packages | |
makepkg --skipchecksums | |
# Install glibc-debug | |
sudo pacman -U *.pkg.tar.xz | |
sed '/^OPTIONS/ s/!debug/debug/g; /^OPTIONS/ s/strip/!strip/g' /etc/makepkg.conf | |
sudo pacman -S gdb pwndbg | |
echo "Don't forget to add `source /usr/share/pwndbg/gdbinit.py` to your ~/.gdbinit" |
@MUWASEC - this compiles for 64-bit systems, but works on 32-bit binaries as well
hi, when i try to rebuild the glibc with the method above with the new version of glibc (2.33) from arch linux i got some error like below :
In file included from <command-line>:
../misc/syslog.c: In function ‘__vsyslog_internal’:
../misc/syslog.c:127:30: error: inlining failed in call to ‘always_inline’ ‘syslog’: function not inlinable
127 | ldbl_strong_alias (__syslog, syslog)
| ^~~~~~
./../include/libc-symbols.h:140:26: note: in definition of macro ‘_strong_alias’
140 | extern __typeof (name) aliasname __attribute__ ((alias (#name))) \
| ^~~~~~~~~
../sysdeps/generic/math_ldbl_opt.h:14:44: note: in expansion of macro ‘strong_alias’
14 | #define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
| ^~~~~~~~~~~~
../misc/syslog.c:127:1: note: in expansion of macro ‘ldbl_strong_alias’
127 | ldbl_strong_alias (__syslog, syslog)
| ^~~~~~~~~~~~~~~~~
In file included from ../sysdeps/unix/sysv/linux/syslog.c:4:
../misc/syslog.c:173:17: note: called from here
173 | syslog(INTERNALLOG,
| ^~~~~~~~~~~~~~~~~~~
174 | "syslog: unknown facility/priority: %x", pri);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-build/sysd-rules:213: /home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-build/misc/syslog.o] Error 1
make[2]: Leaving directory '/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-2.33/misc'
make[1]: *** [Makefile:479: misc/subdir_lib] Error 2
make[1]: Leaving directory '/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-2.33'
make: *** [Makefile:9: all] Error 2
==> ERROR: A failure occurred in build().
Aborting...
zsh: no matches found: *.pkg.tar.xz
do you have any new workaround method for rebuild glibc on arch linux ?
hi, when i try to rebuild the glibc with the method above with the new version of glibc (2.33) from arch linux i got some error like below :
In file included from <command-line>: ../misc/syslog.c: In function ‘__vsyslog_internal’: ../misc/syslog.c:127:30: error: inlining failed in call to ‘always_inline’ ‘syslog’: function not inlinable 127 | ldbl_strong_alias (__syslog, syslog) | ^~~~~~ ./../include/libc-symbols.h:140:26: note: in definition of macro ‘_strong_alias’ 140 | extern __typeof (name) aliasname __attribute__ ((alias (#name))) \ | ^~~~~~~~~ ../sysdeps/generic/math_ldbl_opt.h:14:44: note: in expansion of macro ‘strong_alias’ 14 | #define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname) | ^~~~~~~~~~~~ ../misc/syslog.c:127:1: note: in expansion of macro ‘ldbl_strong_alias’ 127 | ldbl_strong_alias (__syslog, syslog) | ^~~~~~~~~~~~~~~~~ In file included from ../sysdeps/unix/sysv/linux/syslog.c:4: ../misc/syslog.c:173:17: note: called from here 173 | syslog(INTERNALLOG, | ^~~~~~~~~~~~~~~~~~~ 174 | "syslog: unknown facility/priority: %x", pri); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-build/sysd-rules:213: /home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-build/misc/syslog.o] Error 1 make[2]: Leaving directory '/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-2.33/misc' make[1]: *** [Makefile:479: misc/subdir_lib] Error 2 make[1]: Leaving directory '/home/muwa00/packages/glibc/repos/core-x86_64/src/glibc-2.33' make: *** [Makefile:9: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... zsh: no matches found: *.pkg.tar.xz
do you have any new workaround method for rebuild glibc on arch linux ?
aha, i met the same problem, did you slove this ?
The problem is new CFLAGS in the default makepkg.conf, see this forum post.
To fix it you need to install the devtools
package and use the makepkg.conf in /usr/share/devtools/makepkg-x86_64.conf
.
thx @JoanKX
In manjaro, line 22 maybe need change into
sudo pacman -U *.pkg.tar.zst
Arch Linux's libc symbols are available through debuginfod
now.
To enable it in gdb
add set debuginfod enabled on
to your .gdbinit
file. Now the heap
and vis
commands should work out of the box, without needing to recompile the debug symbols for each update of the GLIBC.
Arch Linux's libc symbols are available through
debuginfod
now. To enable it ingdb
addset debuginfod enabled on
to your.gdbinit
file. Now theheap
andvis
commands should work out of the box, without needing to recompile the debug symbols for each update of the GLIBC.
are you sure ? just test it out heap
and vis
command from pwndbg it's not working, i even update the pwndbg repo but still need libc debug symbols, here is the proof image https://ibb.co/PzVd54L
Have you installed debuginfod
? A reboot or re-login cycle may be required in order to make it work.
Yes you have to log out and in again for the environment variables to get updated. Thanks for the tip, I didn't even know debuginfod existed
is it include 32 bit glibc symbols too ?