下载 > 资源分类 >  开发技术 >  C++ > linker and loader 中文版+英文版

linker and loader 中文版+英文版

2008-01-10 上传大小:8.62MB

几乎从有计算机以来,链接器和加载器就是软件开发工具包中的一部分,因为他们是<br>允许使用模块(而不是一个单独的大文件)来构建程序的关键工具。<br>早在1947年,程序员们就开始使用原始的加载器:将程序的例程存储在多个不同的磁<br>带上,并将他们合并、重定位为一个程序。在上世纪60年代早期,这些加载器就已经发展<br>的相当完善了。由于那时内存很
贵且容量有限,计算机的速度(以今天的标准)很慢,为了<br>创建复杂的内存覆盖策略(将大容量的程序加在到少量的内存中),以及重复编辑之前链接<br>过的文件(节省重新创建程序的时间),这些链接器都包含了很多复杂的特性。<br>上世纪70到80年代,链接技术几乎没有什么进展。链接器趋向于更加简单,虚拟内存<br>技术将应用程序和覆盖机制中的大多数存储管理工作都转移给了操作系统,越来越快的计算<br>机和越来越大的磁盘也使得重新链接一个程序或替换个别模块比仅仅链接改变过的地方更加<br>容易了。从上世纪90年代起,由于增加了诸如动态链接共享库和C++的诸多现代特性,链接<br>器又开始变得复杂起来。像IA64这样具有长指令字和编译时访存调度等特性的先进处理器<br>架构,也需要将一些新的特性加入到链接器中以确保在被链接的程序中可以满足代码的这些<br>复杂需求。<br><br>Table of Contents<br>Chapter 0: Front Matter ........................................................ 1<br>Dedication .............................................................................................. 1<br>Introduction ............................................................................................ 1<br>Who is this book for? ......................................................................... 2<br>Chapter summaries ............................................................................. 3<br>The project ......................................................................................... 4<br>Acknowledgements ............................................................................ 5<br>Contact us ........................................................................................... 6<br>Chapter 1: Linking and Loading ........................................... 7<br>What do linkers and loaders do? ............................................................ 7<br>Address binding: a historical perspective .............................................. 7<br>Linking vs. loading .............................................................................. 10<br>Two-pass linking .............................................................................. 12<br>Object code libraries ........................................................................ 15<br>Relocation and code modification .................................................... 17<br>Compiler Drivers .................................................................................. 18<br>Linker command languages ............................................................. 19<br>Linking: a true-life example ................................................................. 20<br>Exercises .............................................................................................. 25<br>Chapter 2: Architectural Issues ........................................... 27<br>Application Binary Interfaces .............................................................. 27<br>Memory Addresses .............................................................................. 28<br>Byte Order and Alignment ............................................................... 28<br>Address formation ................................................................................ 30<br>Instruction formats ............................................................................... 31<br>Procedure Calls and Addressability ..................................................... 32<br>Procedure calls ................................................................................. 33<br>2 Table of Contents<br>Data and instruction references ............................................................ 36<br>IBM 370 ........................................................................................... 37<br>SPARC ............................................................................................. 40<br>SPARC V8 ................................................................................... 40<br>SPARC V9 ................................................................................... 42<br>Intel x86 ........................................................................................... 43<br>Paging and Virtual Memory ................................................................. 45<br>The program address space .............................................................. 48<br>Mapped files ..................................................................................... 49<br>Shared libraries and programs ......................................................... 51<br>Position-independent code ............................................................... 51<br>Intel 386 Segmentation ........................................................................ 53<br>Embedded architectures ....................................................................... 55<br>Address space quirks ........................................................................ 56<br>Non-uniform memory ...................................................................... 56<br>Memory alignment ........................................................................... 57<br>Exercises .............................................................................................. 57<br>Chapter 3: Object Files ........................................................ 59<br>What goes into an object file? .............................................................. 59<br>Designing an object format .............................................................. 60<br>The null object format: MS-DOS .COM files ...................................... 61<br>Code sections: Unix a.out files ............................................................. 61<br>a.out headers .................................................................................... 64<br>Interactions with virtual memory ..................................................... 65<br>Relocation: MS-DOS EXE files ........................................................... 72<br>Symbols and relocation ........................................................................ 74<br>Relocatable a.out .................................................................................. 75<br>Relocation entries ............................................................................. 78<br>Symbols and strings ......................................................................... 80<br>a.out summary .................................................................................. 82<br>Unix ELF ............................................................................................. 82<br>Relocatable files ............................................................................... 85<br>ELF executable files ......................................................................... 92<br>ELF summary ................................................................................... 94<br>Table of Contents 3<br>IBM 360 object format ......................................................................... 94<br>ESD records ..................................................................................... 95<br>TXT records ..................................................................................... 97<br>RLD records ..................................................................................... 97<br>END records ..................................................................................... 98<br>Summary .......................................................................................... 98<br>Microsoft Portable Executable format ................................................. 99<br>PE special sections ......................................................................... 105<br>Running a PE executable ............................................................... 107<br>PE and COFF ................................................................................. 107<br>PE summary ................................................................................... 108<br>Intel/Microsoft OMF files .................................................................. 108<br>OMF records .................................................................................. 110<br>Details of an OMF file ................................................................... 111<br>Summary of OMF .......................................................................... 114<br>Comparison of object formats ............................................................ 114<br>Project ................................................................................................ 115<br>Exercises ............................................................................................ 117<br>Chapter 4: Storage allocation ............................................ 119<br>Segments and addresses ..................................................................... 119<br>Simple storage layout ......................................................................... 120<br>Multiple segment types ...................................................................... 121<br>Segment and page alignment ............................................................. 124<br>Common blocks and other special segments ..................................... 125<br>Common ......................................................................................... 125<br>C++ duplicate removal ................................................................... 127<br>Initializers and finalizers ................................................................ 130<br>IBM pseudo-registers ..................................................................... 131<br>Special tables ................................................................................. 134<br>X86 segmented storage allocation ................................................. 134<br>Linker control scripts ......................................................................... 136<br>Embedded system storage allocation ................................................. 138<br>Storage allocation in practice ............................................................. 138<br>Storage allocation in Unix a.out linkers ......................................... 139<br>4 Table of Contents<br>Storage allocation in ELF .............................................................. 141<br>Storage allocation in Windows linkers .......................................... 144<br>Exercises ............................................................................................ 146<br>Project ................................................................................................ 147<br>Chapter 5: Symbol management ....................................... 149<br>Binding and name resolution ............................................................. 149<br>Symbol table formats ......................................................................... 150<br>Module tables ................................................................................. 153<br>Global symbol table ....................................................................... 154<br>Symbol resolution .......................................................................... 157<br>Special symbols ............................................................................. 158<br>Name mangling .................................................................................. 158<br>Simple C and Fortran name mangling ........................................... 158<br>C++ type encoding: types and scopes ............................................ 160<br>Link-time type checking ................................................................ 163<br>Weak external and other kinds of symbols ........................................ 164<br>Maintaining debugging information .................................................. 164<br>Line number information ............................................................... 164<br>Symbol and variable information ................................................... 165<br>Practical issues ............................................................................... 166<br>Exercises ............................................................................................ 167<br>Project ................................................................................................ 167<br>Chapter 6: Libraries ........................................................... 169<br>Purpose of libraries ............................................................................ 169<br>Library formats .................................................................................. 169<br>Using the operating system ............................................................ 169<br>Unix and Windows Archive files ................................................... 170<br>Unix archives ............................................................................. 170<br>Extension to 64 bits ........................................................................ 174<br>Intel OMF libraries ........................................................................ 174<br>Creating libraries ................................................................................ 176<br>Searching libraries ............................................................................. 177<br>Table of Contents 5<br>Performance issues ............................................................................. 179<br>Weak external symbols ...................................................................... 179<br>Exercises ............................................................................................ 181<br>Project ................................................................................................ 181<br>Chapter 7: Relocation ......................................................... 183<br>Hardware and software relocation ..................................................... 183<br>Link time and load time relocation .................................................... 184<br>Symbol and segment relocation ......................................................... 185<br>Symbol lookups ............................................................................. 186<br>Basic relocation techniques ................................................................ 186<br>Instruction relocation ..................................................................... 188<br>X86 instruction relocation .......................................................... 189<br>SPARC instruction relocation .................................................... 189<br>ECOFF segment relocation ............................................................ 191<br>ELF relocation ............................................................................... 193<br>OMF relocation .............................................................................. 193<br>Relinkable and relocatable output formats ........................................ 194<br>Other relocation formats .................................................................... 194<br>Chained references ......................................................................... 195<br>Bit maps ......................................................................................... 195<br>Special segments ............................................................................ 196<br>Relocation special cases ..................................................................... 197<br>Exercises ............................................................................................ 197<br>Project ................................................................................................ 198<br>Chapter 8: Loading and overlays ...................................... 201<br>Basic loading ...................................................................................... 201<br>Basic loading, with relocation ............................................................ 202<br>Position-independent code ................................................................. 203<br>TSS/360 position independent code ............................................... 203<br>Per-routine pointer tables ............................................................... 206<br>Table of Contents ........................................................................... 207<br>ELF position independent code ..................................................... 208<br>6 Table of Contents<br>PIC costs and benefits .................................................................... 212<br>Bootstrap loading ............................................................................... 213<br>Tree structured overlays ..................................................................... 214<br>Defining overlays ........................................................................... 217<br>Implementation of overlays ........................................................... 220<br>Overlay fine points ......................................................................... 222<br>Data ............................................................................................ 222<br>Duplicated code ......................................................................... 222<br>Multiple regions ......................................................................... 223<br>Overlay summary ........................................................................... 223<br>Exercises ............................................................................................ 223<br>Project ................................................................................................ 224<br>Chapter 9: Shared libraries ............................................... 227<br>Binding time ...................................................................................... 230<br>Shared libraries in practice ................................................................. 231<br>Address space management ............................................................... 231<br>Structure of shared libraries ............................................................... 232<br>Creating shared libraries .................................................................... 233<br>Creating the jump table .................................................................. 234<br>Creating the shared library ............................................................. 235<br>Creating the stub library ................................................................. 235<br>Version naming .............................................................................. 237<br>Linking with shared libraries ............................................................. 238<br>Running with shared libraries ............................................................ 238<br>The malloc hack, and other shared library problems ......................... 240<br>Exercises ............................................................................................ 243<br>Project ................................................................................................ 244<br>Chapter 10: Dynamic Linking and Loading .................... 247<br>ELF dynamic linking ......................................................................... 248<br>Contents of an ELF file ...................................................................... 248<br>Loading a dynamically linked program ............................................. 253<br>Starting the dynamic linker ............................................................ 253<br>Table of Contents 7<br>Finding the libraries ....................................................................... 254<br>Shared library initialization ............................................................ 255<br>Lazy procedure linkage with the PLT ................................................ 256<br>Other peculiarities of dynamic linking .............................................. 258<br>Static initializations ........................................................................ 258<br>Library versions ............................................................................. 259<br>Dynamic loading at runtime ............................................................... 260<br>Microsoft Dynamic Link Libraries .................................................... 260<br>Imported and exported symbols in PE files ................................... 261<br>Lazy binding .................................................................................. 266<br>DLLs and threads ........................................................................... 267<br>OSF/1 pseudo-static shared libraries ................................................. 267<br>Making shared libraries fast ............................................................... 268<br>Comparison of dynamic linking approaches ...................................... 270<br>Exercises ............................................................................................ 271<br>Project ................................................................................................ 271<br>Chapter 11: Advanced techniques ..................................... 273<br>Techniques for C++ ........................................................................... 273<br>Trial linking .................................................................................... 274<br>Duplicate code elimination ............................................................ 276<br>Database approaches ...................................................................... 278<br>Incremental linking and relinking ...................................................... 278<br>Link time garbage collection ............................................................. 281<br>Link time optimization ....................................................................... 282<br>Link time code generation ................................................................. 284<br>Link-time profiling and instrumentation ........................................ 284<br>Link time assembler ....................................................................... 285<br>Load time code generation ............................................................. 285<br>The Java linking model ...................................................................... 287<br>Loading Java classes ...................................................................... 288<br>Exercises ............................................................................................ 290<br>Project ................................................................................................ 291<br>8 Table of Contents<br>Chapter 12: References ...................................................... 293<br>Perl books ....................................................................................... 295
...展开收缩
综合评分:2.2(728位用户评分)
开通VIP C币充值 立即下载

评论共有172条

name
leevideom2017-11-08 14:39:19
好东西大家要分享,谢谢
name
wanglonghua862017-11-07 15:16:09
不错的资源,能够更深入理解可执行程序链接和执行的原理。谢谢楼主分享。
name
qq_352595982017-10-19 18:44:05
这个资源有问题
name
xiaoming1412017-10-11 16:56:29
真的是好书!早就想学链接器了
name
andy155418932017-10-09 22:14:24
好书谢谢分享
name
learnmyself19912017-07-17 13:16:08
不错的学习资料。值得一读,能学到东西
name
plfay2017-04-26 01:51:24
不错的东西
name
xiaobpsp2016-11-11 14:36:15
很不错的资料~
name
midhillzhou2016-10-13 15:56:56
非常感谢 非常有用 赞
name
zhangjiao1232016-05-17 21:32:09
非常好,好好学些

评论资源

您不能发表评论,可能是以下原因:

登录后才能评论

待评论资源
 

热门专辑

开发技术热门标签

VIP会员动态

关闭
img

spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip

资源所需积分/C币 当前拥有积分 当前拥有C币
5 0 0
为了良好体验,不建议使用迅雷下载
确认下载
img

linker and loader 中文版+英文版

会员到期时间: 剩余下载个数: 剩余C币:593 剩余积分:0
为了良好体验,不建议使用迅雷下载
VIP下载
您今日下载次数已达上限(为了良好下载体验及使用,每位用户24小时之内最多可下载20个资源)

积分不足!

资源所需积分/C币 当前拥有积分
您可以选择
开通VIP
4000万
程序员的必选
600万
绿色安全资源
现在开通
立省522元
或者
购买C币兑换积分 C币抽奖
img

资源所需积分/C币 当前拥有积分 当前拥有C币
5 4 45
(仅够下载10个资源)
为了良好体验,不建议使用迅雷下载
确认下载
img

资源所需积分/C币 当前拥有积分 当前拥有C币
5 0 0
为了良好体验,不建议使用迅雷下载
C币充值 开通VIP
img

资源所需积分/C币 当前拥有积分 当前拥有C币
5 4 45
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
确认下载
下载

兑换成功

你当前的下载分为234开始下载资源
你还不是VIP会员
开通VIP会员权限,免积分下载
立即开通

你下载资源过于频繁,请输入验证码

您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:webmaster@csdn.net!

举报

若举报审核通过,可奖励20下载分

  • 举报人:
  • 被举报人:
  • 举报的资源分:
  • *类型:
  • *详细原因: