Shared Library/Compiler/Linker/Loader 역할
1600 단어 shared_libraryGCCGCC
컴파일러가 하는일 (gcc)
- C Pre Processor(cpp) 가 #define, #include 구문등을 전처리하여 hello.i 생성
cpp hello.c > hello.i
- C compiler(cc1) 가 전처리한 hello.i 소스를 어셈블리로 컴파일하여 hello.s 생성
gcc -S hello.i
- assembler(as) 는 hello.s 를 어셈블하여 object (hello.o) 생성
as -o hello.o hello.s
- linker(collect2) 는 printf 등 외부 library 에 있는 symbol 을 링크해서 최종 프로그램 생성(a.out)
공유 라이브러리
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
공유 라이브러리와 연결된 프로그램을 실행하면 내부적으로 Dynamic Loader 라는 프로그램이 실행됨
1. dynamic link 된 공유 라이브러리를 찾아서 메모리에 로딩
2. entry function (C 언어일 경우 main 함수)를 찾아서 호출
3. 프로그램 실행
runtime environment
프로그램 실행시 main함수 호출 및 여러가지 수행. C runtime env 좀 더 찾아보기.
https://en.wikipedia.org/wiki/Runtime_system
https://en.wikipedia.org/wiki/Crt0
References
https://www.lesstif.com/software-architect/shared-library-linker-loader-12943542.html
Author And Source
이 문제에 관하여(Shared Library/Compiler/Linker/Loader 역할), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@soopsaram/Shared-LibraryCompilerLinkerLoader-역할저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)