复旦大学:《计算机原理 Computer System》课程PPT课件_Linking II(• Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading)

Linking‖l
1 Linking Ⅱ

Outline Static linking Symbols Symbol Table Relocation Executable Object Files Loading Suggested reading: 7.3-7.5, 7.7-7.9
2 Outline • Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading • Suggested reading: 7.3~7.5, 7.7~7.9

main. c swap c 1. /main. c * swap c void swapO 123 extern int bufa: 23456789 nt buf[2]={1,2} 4. int bufpo &buf[o] 5. int "bufp1 Int maino 6 7. void swapO swapo eturn o If temp 10.} 10. 11 bufp1 =&buf[1] 12 remp =*bufo 13 bufo = bufp1 14 bufpl temp Figure 7.1 P541
3 main.c swap.c 1. /*main.c */ 2. void swap() ; 3. 4. int buf[2] = {1, 2}; 5. 6. Int main() 7. { 8. swap() ; 9. return 0 ; 10. } 1. /*swap.c */ 2. extern int buf[]; 3. 4. int *bufp0 = &buf[0] 5. int *bufp1 ; 6. 7. void swap() 8. { 9. int temp ; 10. 11. bufp1 = &buf[1]; 12. temp = *bufp0 ; 13. *bufp0 = *bufp1 ; 14. *bufp1 = temp ; 15. } Figure 7.1 P541

Example P542 unix> gCc -O2 -g -o p main. c swapc cpp [args] main. c/tmp/main.i ccl /tmp/main. i main. c -o2 [args] -o /tmp/main. s as [args] -o /tmp/main. o /tmp/main.s
4 unix> gcc -O2 -g -o p main.c swap.c cpp [args] main.c /tmp/main.i cc1 /tmp/main.i main.c -O2 [args] -o /tmp/main.s as [args] -o /tmp/main.o /tmp/main.s ld -o p [system obj files] /tmp/main.o /tmp/swap.o unix> Example P542

Obiect file Object file Various code and data sections Instructions are in one section Initialized global variables are in one section Uninitialized global variables are in one section
5 Object file • Object file – Various code and data sections – Instructions are in one section – Initialized global variables are in one section – Uninitialized global variables are in one section

ELF object file format ElF header Program header table (required for executables) text section data section bss section symtab rel. txt rel.data debue g line strap Section header table (required for relocatables) Figure 7.3 P544
6 ELF header Program header table (required for executables) .text section .data section .bss section .symtab .rel.txt .rel.data .debug Section header table (required for relocatables) .line .strtab ELF object file format Figure 7.3 P544

7.3 Ob ject Files
7 7.3 Object Files

Obiect files Relocatable object file Contain binary code and data in a form that can be combined with other relocatable ob ject files to create an executable file Executable object file Contains binary code and data in a form that can be copied directly into memory and executed
8 Object files • Relocatable object file – Contain binary code and data in a form that can be combined with other relocatable object files to create an executable file • Executable object file – Contains binary code and data in a form that can be copied directly into memory and executed

Obiect files Shared ob Ject file e A special type of relocatable object file that can be loaded into memory and linked dynamically,at either load time or run time
9 Object files • Shared object file – A special type of relocatable object file that can be loaded into memory and linked dynamically, at either load time or run time

7.2 Static Linking
10 7.2 Static Linking
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Dynamic Memory Allocation(• Implementation of a simple allocator • Explicit Free List • Segregated Free List).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Multilevel page tables • Different points of view • Pentium/Linux Memory System • Memory Mapping).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Virtual Space• Address translation • Accelerating translation• Different points of view).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• Cache mountain • Matrix multiplication).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• General concepts • 3 ways to organize cache memory • Issues with writes • Write cache friendly codes • Cache mountain).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Memory Hierarchy(• Random-Access Memory(RAM)• Nonvolatile Memory • Disk Storage • Locality • Memory hierarchy).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Hardware Organization.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_13 Code Optimization(• Optimizing Blockers • Understanding Modern Processor • More Code Optimization techniques • Performance Tuning).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_12b Code Optimization(• Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part II.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_09、10 Sequential CPU Implementation.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Processor Architecture.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Heterogeneous Data Structures & Alignment; Putting it Together; Floating Point.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Procedure Call and Array.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs Ⅱ.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Operations; Floating Points.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Representations.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Introduction to Computer Systems; Information is Bits+Context; Information Storage.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter2.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level(2)Representation of Programs.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter4 Processor Architecture.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter5 Optimizing Program Performance.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter6 The Memory Hierarchy.ppt
- 复旦大学:《计算机网络与网页制作》课程教学大纲 Computer Network and Webpage Design.pdf
- 《当代教育理论与实践》论文:大学计算机基础教学实践与思考(复旦大学:肖川、张向东).pdf
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)01 计算机网络基础.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)02 两类基本网络(局域网、无线局域网).pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)03 因特网基础知识.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)04 传统的Internet服务.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)05 新型的Internet应用.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)06 Internet安全.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)07 Dreamweaver CS5入门.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)08 创建一个新站点.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)09 添加文本和图像.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)10 用CSS设定页面样式.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)11 用CSS作页面布局.pptx