$ gcc -fPIC -c ctest1.c ctest2.c $ ls ctest1.c ctest1.o ctest2.c ctest2.o |
$ gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 ctest1.o ctest2.o
|
$ readelf -h libctest.so.1.0 ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Shared object file) Machine: Intel 80386 Version: 0x1 Entry point address: 0x3f0 Start of program headers: 52 (bytes into file) Start of section headers: 4396 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 7 Size of section headers: 40 (bytes) Number of section headers: 27 Section header string table index: 24 | s |
$ gcc -L. prog.c -lctest -o progd
'Hacking > Binary' 카테고리의 다른 글
Binary@library# 정적 라이브러리 (0) | 2018.02.25 |
---|---|
Binary@ELF# ldd - 공유 라이브러리 의존관계 확인 (0) | 2018.02.25 |
Binary@ELF# nm - 오브젝트 파일에 포함된 심볼 확인 (0) | 2018.02.17 |
Binary@ELF# ELF Header (0) | 2018.02.15 |
How main() is executed on Linux (0) | 2017.05.29 |