Code:
$ LD_LIBRARY_PATH=. ./1
./1: error while loading shared libraries: libhello.so: failed to map segment from shared object
You seem to have a problem with your program headers:
Code:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NULL 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0
LOAD 0x0000000000000000 0x0000000000001000 0x0000000000001000
0x0000000000000000 0x0000000000000000 RW 1000
LOAD 0x0000000000001000 0x0000000000001000 0x0000000000001000
0x0000000000000000 0x0000000000000000 RW 1000
LOAD 0x0000000000001000 0x0000000000000000 0x0000000000000000
0x0000000000000016 0x0000000000000016 R E 1000
LOAD 0x0000000000002000 0x0000000000001000 0x0000000000001000
0x00000000000001f1 0x00000000000001f1 RWE 1000
DYNAMIC 0x00000000000020f8 0x00000000000010f8 0x00000000000010f8
0x00000000000000d0 0x00000000000000d0 RWE 1000
I see three issues here: (1) the first two LOAD segments are both zero size; (2) the other two LOAD segments overlap the first two; (3) the DYNAMIC segment is misaligned -- the alignment is set to 1000 but its address is not page-aligned.