cpp hello.c > hello.i
gcc -S hello.i
as -o hello.o hello.s
static library -> .a
dynamic library -> .so
$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.18, not stripped
공유 라이브러리와 연결된 프로그램을 실행하면 내부적으로 Dynamic Loader 라는 프로그램이 실행됨
1. dynamic link 된 공유 라이브러리를 찾아서 메모리에 로딩
2. entry function (C 언어일 경우 main 함수)를 찾아서 호출
3. 프로그램 실행
프로그램 실행시 main함수 호출 및 여러가지 수행. C runtime env 좀 더 찾아보기.
https://en.wikipedia.org/wiki/Runtime_system
https://en.wikipedia.org/wiki/Crt0
https://www.lesstif.com/software-architect/shared-library-linker-loader-12943542.html