jfo planet

Hope is the best gift that tomorrow gives.

  • 首页
  • 分类
  • 归档
  • 标签
  • 搜索
close

ELF文件动态链接时 GOT,PLT 的变化过程

发表于 2007-11-12   |   分类于 gcc/binutils/make/共享库
Intel平台下Linux中ELF文件动态链接的加载、解析及实例分析(一): 加载http://www.ibm.com/developerworks/cn/linux/l-elf/part1/index.htmlIntel平台下linux中ELF文件动态链接的加载、解析及实例分析(二): 函数解析与卸载http://www.ibm.com/developerworks/cn/linux/l-elf/part2/index.htmlhttp://linux.chinaunix.net/doc/system/2005-01-13/777.shtml最后我们讨论ELF文件的动态连接机制。每一个外部定义的符号在全局偏移表 (Global Offset Table GOT)中有相应的条目,如果符号是函数则在过程连接表(Procedure Linkage Table PLT)中也有相应的条目,且一个PLT条目对应一个GOT条目。对外部定义函数解析可能是整个ELF文件规范中最复杂的,下面是函数符号解析过程的一个 描述。1:代码中调用外部函数func,语句形式为call 0xaabbccdd,地址0 ...
阅读全文 »

【zz】从程序员角度看ELF

发表于 2007-11-12   |   分类于 gcc/binutils/make/共享库
my特殊说明(by jfo)对于static-linked或shared-linked的ELF可执行文件,他们的入口点都是 _start,然后由 _start 函数调用 _init 执行相关的 .init 节中的初始化代码!(just disassemble the code)这说明内核在加载image后,在控制转入_start之前,_init 没有被调用;对于需要动态链接的可执行文件,内核将控制权转移给interpreter,interpreter 在完成链接工作后,将控制权转移给 _start ,也不会直接执行.init 节中的代码!(这里针对ELF可执行文件,对于共享库的.init段,还是由interpreter来调用的!!!see 启动过程::共享库的初始化)而dlopen 一个 .so 共享库后,_init 函数在返回前会被调用,.so 共享库是没有 _start 的!This is the example, which makes a shared .so file executable:http://hi.baidu.com/j%5Ffo/blog/item/15681 ...
阅读全文 »

【zz】使用 Kprobes 调试内核

发表于 2007-11-11   |   分类于 Linux Debug
使用 Kprobes 调试内核http://www.ibm.com/developerworks/cn/linux/l-kprobes.html#main 将 printk 插入到运行中的 Linux 内核Prasanna S. Panchamukhi (), 开发人员,Linux Technology Center, IBM India Software Labs2004 年 9 月 19 日使用 printk 收集 Linux ™ 内核的调试信息是一个众所周知的方法 —— 而使用了 Kprobes,不需要经常重新引导和重新编译内核就可以完成这一任务。Kprobes 与 2.6 内核结合起来提供了一个动态插入 printk’s 的轻量级、无干扰而且强大的装置。记录调试信息(比如内核栈追踪、内核数据结构和寄存器)日志从来没有这么简单过! Kprobes 是 Linux 中的一个简单的轻量级装置,让您可以将断点插入到正在运行的内核之中。 Kprobes 提供了一个强行进入任何内核例程并从中断处理器无干扰地收集信息的接口。使用 Kprobes 可以 ...
阅读全文 »

【zz】printk()调试信息分级显示脚本的编写方法

发表于 2007-11-11   |   分类于 Linux Debug
printk()调试信息分级显示脚本的编写方法   大家都知道,在编写内核程序时printk()在<linux/kernel.h>中定义了一些用于调试的宏,它们是:   KERN_EMERG "<0>" 系统不可用   KERN_ALERT "<1>" 必须采取措施   KERN_CRIT "<2>" 严重状态   KERN_ERR "<3>" 错误状态    KERN_WARNING "<4>" 警告状态   KERN_NOTICE "<5>" 正常但重要的情况   KERN_INFO "<6>" ...
阅读全文 »

The ELF Auxiliary Table

发表于 2007-11-04   |   分类于 Linux
The ELF Auxiliary TableEvery process has a stack, but the system defines no fixed stack address. Furthermore, a program’s stack address can change from one system to another, and even from one process invocation to another. Thus the process initialization code must use the stack address in general purpose register r1. Data in the stack segment at addresses below the stack pointer contain undefined values.Whereas the argument and environment vectors transmit information from one a ...
阅读全文 »

【zz】输出1,2,...,100,99,...,2,1

发表于 2007-11-03   |   分类于 c/c++/algorithm
www.cppblog.com/shifan3/archive/2007/11/02/35767.html输出1,2,…,100,99,…,2,1短路算法和逗号表达式粉墨登场了,一行搞定~#include <cstdio>void f(int i,int n){     printf("%dn",i),(i<n)&&(f(i+1,n),printf("%dn",i));}int main(){     f(1,100);}
阅读全文 »

编写操作系统之使用GRUB multiboot

发表于 2007-11-03   |   分类于 Linux
【原文】www.oldlinux.org/oldlinux/viewthread.phpMultiboot Specificationwww.gnu.org/software/grub/manual/multiboot/multiboot.html#multiboot_002eh编写操作系统之使用GRUB[这个贴子最后由sololxy在 2006/04/24 03:21am 第 2 次编辑] 9_454.rar (18.26 KB)使用GRUB                                    翻译 :   solo_lxy              ...
阅读全文 »

Makefile : chains of implicit rules examples

发表于 2007-10-26   |   分类于 gcc/binutils/make/共享库
chains of implicit rules examplesthe source code: /////////////////////////////////////////////////////////////////// //main.e: #include "fun1.h" #include "fun2.h" int main() {     fun1();     fun2();     printf("mainn"); } /////////////////////////////////////////////// ...
阅读全文 »

Makefile

发表于 2007-10-24   |   分类于 gcc/binutils/make/共享库
make command line options:-r Eliminate use of the built-in implicit rules. Also clear out thedefault list of suffixes for suffix rules.-s Silent operation; do not print the commands as they are executed.-t Touch files (mark them up to date without really changing them)instead of running their commands. This is used to pretend thatthe commands were done, in order to fool future invocations ofmake.-n Print the commands that would be executed, but do not executethem.-k Continue as much as pos ...
阅读全文 »

OBJECT AND LIBRARY ORDERING

发表于 2007-10-01   |   分类于 gcc/binutils/make/共享库
OBJECT AND LIBRARY ORDERING The ordering of object files, archive libraries, and shared libraries on the command line affects how symbols are resolved. For example, if an archive library appears before an object file or shared library that refer- ences one of its symbols, the linker may report that symbol as unresolved. Unresolved symbol errors can be avoided by adhering to the following suggestions: + Object files should be ordered before all archive libraries and shared librar ...
阅读全文 »
1…474849…61
jfo

jfo

605 日志
38 分类
4 标签
RSS
GitHub 微博
友情链接
  • 收藏夹
  • 网络剪贴板
  • 爱逛吧
© 2007 - 2018 jfo
由 Hexo 强力驱动
主题 - NexT.Pisces