본문 바로가기

Basic Learning/Operating System Concepts

GNU Linker

 

이 포스트는 서울대학교의 '운영체제의 기초' 강의를 개인 학습용으로 작성한 포스트입니다.

 

 

 

Program Development Process

 

 

Compiler : Convert each source file into object file

Linker : Combine all object files into one executable file

Loader : Load instructions and data into those positions

 

 

Linking Process

Section

Object file을 구성하는 단위, data를 묶어놓는 단위

Contigous memory area 할당

Text, Data, BSS, Other sections(Symbol table, Relocation table...)

 

* BSS (Block Started by Symbol) : 초기화되지 않은 전역 변수 포함

 

 

Linker

Linker script를 통해 layerout를 지정가능

별도로 선언되지 않으면 default linker script 사용

 

 

Loader

정해진 메모리 공간에 executable file의 binary value를 로드함

Text section의 첫 번째 주소에 SetPC

 

 

Symbol table

function, global variable의 주소를 저장

Symbol name + Section + Offset으로 구성

Compiler는 symbol table을 보고 symbolic name을 memory address로 변경

 

 

Relocation table

Compiler는 다른 section의 symbol address를 알지 못함 (cross reference)

모르면 0으로 체크하고 relocation table에 기재

Reference Section + Offset + Symbol name으로 구성

Linker가 relocation table보고 0으로 체크한 부분을 채워줌

 

 

 

'Basic Learning > Operating System Concepts' 카테고리의 다른 글

Segmentation and Paging  (0) 2020.06.16
Dynamic Storage Allocation  (0) 2020.06.16
Deadlock  (0) 2020.06.15
Process Synchronization  (0) 2020.06.14
CPU Scheduling  (0) 2020.06.14