Thursday, July 26, 2012

How to compile the glibc-2.14.1 on Slackware 13.37

Note: This article is nothing about build a cross-compiler toolchains. The only reason I need to rebuild the glibc is for hacking the glibc itself, which mean to providing a debugging platform. If you need to build a cross-compiler toolchains( for Play Station III?) , go to openWRT community.

1, download the glibc-2.14.1.

2, Preparation before compiling:

root@sl13:/home/libs/2.14-build# mkdir -p /home/root_shawn/etc
root@sl13:/home/libs/2.14-build# cp /etc/ /home/root_shawn/etc/

3, Decompressing the source code and compiling:

root@sl13:/home/libs# tar jxvf glibc-2.14.1.tar.bz2
root@sl13:/home/libs/2.14-build# ../glibc-2.14.1/configure --prefix=/home/root_shawn --with-tls --enable-add-ons=nptl
root@sl13:/home/libs/2.14-build# make -j 2 && make install

4, Edit some config files:

add "export LIBRARY_PATH=/home/root_shawn/lib:/lib:/usr/lib" to the file /etc/profile

edit the file "/usr/lib/gcc/i486-slackware-linux/4.5.2/specs", and replace "/lib/" with "/home/root_shawn/lib/"

add "/home/root_shawn/lib" to the file /etc/

root@sl13:/home/libs/2.14-build# ldconfig
root@sl13:/home/libs/2.14-build# source /etc/profile

5, Testing the current version of glibc

#include <stdio.h>
#include <gnu/libc-version.h>
int main ()
        printf("%s\n", gnu_get_libc_version ());
        return 0;

root@sl13:~# gcc hello.c
root@sl13:~# ./a.out

Bingo, it's already upgrade!

6, Check the linking path

root@sl13:~# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x8048340
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00023 0x00023 R   0x1
      [Requesting program interpreter: /home/root_shawn/lib/]
  LOAD           0x000000 0x08048000 0x08048000 0x00504 0x00504 R E 0x1000
  LOAD           0x000504 0x08049504 0x08049504 0x00104 0x0010c RW  0x1000
  DYNAMIC        0x000518 0x08049518 0x08049518 0x000c8 0x000c8 RW  0x4
  NOTE           0x000138 0x08048138 0x08048138 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag

[Requesting program interpreter: /home/root_shawn/lib/] --- that's what I want. Shit~ I can debug the fucking glibc now. I'll keep reading the Phrack paper( avoid the stack canary to remote exploit for profit and fun? ) this week. 29% is too far away from my goal/gold.....hmm...maybe emacs's lines counter has some problem @_@

btw: The Architecture wants the Matrix running by the paradigms of  closed system/linear/mechanic/engineering/controlled. The Oracle wants the Matrix becoming a diversity world with infinitely possibility, by following the paradigms of open system/non-linear/biological/evolving/out of control. The matters is depend on your "choice".


Anonymous said...

You might accomplish eight to twelve repetitions for every established.

Also visit my web page - bowflex dumbbells

Anonymous said...

Chrome will be probably the most high-priced of these materials with
products that could value eighteen hundred dollars or more.

Here is my web site - please click the next site

Anonymous said...

In the event the heating and cooling approach transpires swiftly, the warping outcome is magnified,
given that the instrument will no have the perfect time to adjust and keep its
original condition in excess of the alter.

Here is my web-site ::

Anonymous said...

And hardly ever intellect the lengthy push and watching for the gear.

Here is my webpage;

Anonymous said...

I say laser since when i work out on this device,
the cable pullies give me finish manage of each and every exercising without any
possibility of injuries.

Here is my web blog:

Anonymous said...

Bowflex is usually a dependable name in house gym equipment which
modern dumbbell established is like acquiring fifteen distinct dumbbells in 1.

Look at my blog post Suggested Studying

Anonymous said...

Are you about to stop trying on endeavoring to drop
bodyweight by means of long gymnasium sessions or managing
daily right after work with little if any clear improvements by any means?

Visit my weblog: cheap dumbbell sets

Anonymous said...

These treadmills have just one significant drawback however which may
quite effectively make some prospective buyers frown upon it.

Review my page - relevant webpage