Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An executable that doesn't require any library, even libc?

Tags:

elf

g-wan

[root@ gwan]# file gwan 
gwan: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped
[root@ gwan]# ldd gwan 
    not a dynamic executable

[root@ gwan]# du -csh gwan 
208K    gwan
208K    total

How does gwan do the magic?

As a web server, it needs to do socket programing and many other heavy jobs, which all require linking with libc, but that seems not the case with gwan. How is that possible?

like image 235
Je Rog Avatar asked May 22 '26 14:05

Je Rog


1 Answers

As usual it is no magic, GWAN is packed with UPX to look smaller saving around 200kB. Unpacking it results the below.

 > ldd gwan
 linux-gate.so.1 =>  (0xf770c000)
 libpthread.so.0 => /usr/lib32/libpthread.so.0 (0xf76e9000)
 librt.so.1 => /usr/lib32/librt.so.1 (0xf76e0000)
 libdl.so.2 => /usr/lib32/libdl.so.2 (0xf76db000)
 libm.so.6 => /usr/lib32/libm.so.6 (0xf76b1000)
 libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf7695000)
 libc.so.6 => /usr/lib32/libc.so.6 (0xf752c000)
 /lib/ld-linux.so.2 (0xf770d000)
like image 73
Lonewolfer Avatar answered May 27 '26 00:05

Lonewolfer