程序加载/执行 [英] program loading/execution

查看:158
本文介绍了程序加载/执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编译器的初学者,但我非常有兴趣了解程序是如何构造的(二进制)以及如何读取和加载到内存中以供执行。你们建议我阅读哪些电子书/书籍/教程以便快速入门? 解决方案

编译器和可执行文件是远程相关的。 (实际的可执行文件是由连接器 ld 编译的,而不是编译器)。



在Linux系统上, a href =http://en.wikipedia.org/wiki/Linux_kernel =nofollow> linux内核使用复制写入请求分页

a>技术来延迟加载程序页面,用于 ELF 可执行文件。共享库可以动态加载,最好包含位置独立代码您可能有兴趣阅读编译器构建,Levine关于 linkers&加载器 Linux大会指南程序库Howto ldd(1) execve(2) intro(2) fork(2) mmap(2) dlopen(3) elf(5) proc(5) signal(7)手册页。



试着理解 cat / proc / self / maps 显示的是什么(进程的内存映射这样做 cat )。你也可以玩 objdump


I'm a beginner in compilers but I'm very interested in learning about how a program is structured (the binary) and how it is read and loaded in memory for execution. What ebooks/books/tutorials do you guys suggest me reading for a quick start?

解决方案

Compilers and executable binaries are remotely related. (the actual executable is built by the linker ld, not the compiler).

On Linux systems, the linux kernel use copy-on-write and demand-paging techniques to lazily load the program pages, for ELF executables. Shared libraries may be dynamically loaded and preferably contain position independent code.

You could be interested in reading about compiler construction, Levine's book on linkers & loaders, the Linux Assembly Howto, the Program Library Howto, the ldd(1), execve(2), intro(2), fork(2), mmap(2), dlopen(3), elf(5), proc(5), signal(7) man pages.

Try also to understand what cat /proc/self/maps is showing you (the memory map of the process doing that cat). You can also play with objdump.

这篇关于程序加载/执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆