본문 바로가기

카테고리 없음

Loader & Linker

Loading: program->memory        ->Absolute loader(memory에 올려줌)

Relocation: modifies the object program        ->linking loader(relocation 하면서 memory에 올려줌)

* 프로그램 시작 주소가 달라지는 경우 target address를 relocation

Linking: combines two or more seperate relocatable object programs        ->Linker

*2개 이상의 object 프로그램들을 linking해줌.

====> Linking Loader

 

 

[Absolute Loader]

*string을 int로 바꾸는 로직: var=var*10+a[i]-'0'

 

[A simple Bootstrap Loader]

부팅을 도와주는 Absolute Loader

간단한 형태의 object program을 메모리에 던져주고 pc

left shift 한번 -> *2를 하는 효과

->4번 shift , 16진수에서 var=var*10+a[i]-'0' 한거랑 똑같음(?) -> 이 식은 10진수 기준 로직이니까.

하나의 ch 읽어서 jumping하는?

 

[Machine-Dependent Loader Feature]

absolute loader의 단점

1) 프로그래머가 실제 올라갈 메모리 주소를 지정해야 함.

->  여러개의 프로그램을 자유자재로 올리기에는 문제가 생길 수 있음.

 

->Solution: program relocation & program linking

프로그램 재배치해주는 상대 로더(Relative Loader)

재배치 방법은? 

-Modification records(수정레코드)

->나중에 주소가 바껴야하는것(절대주소)과 안바껴도되는것(상대주소) 구분해서

-Relocation bits: every relocation을 위해 수정레코드 대신에 사용하기도 함.

 

[Program Linking]

-나눠서 어셈블리 될 수 있음

-제어섹션들 합칠 때 주소를 적절히 만들어 연결해줘야 함.

-외부참조 주소부분 비워뒀었음.(0으로-2장 82p 참조)->relocation할 때 loader가 해줌.

-