码迷,mamicode.com
首页 > 其他好文 > 详细

动态链接

时间:2016-05-22 23:02:43      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

#include<stdio.h>
void f()
{

}
__attribute__((constructor)) void before()
{

printf("Hello\n");
}

 

安装glibc-debug之前

 

(gdb) bt
#0 0x00007ffff7bd9702 in before () from ./pre.so
#1 0x00007ffff7dea3a3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#2 0x00007ffff7ddc46a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#3 0x0000000000000001 in ?? ()
#4 0x00007fffffffe73b in ?? ()
#5 0x0000000000000000 in ?? ()

 

安装之后

(gdb) bt
#0 0x00007ffff7bd9702 in before () from ./pre.so
#1 0x00007ffff7dea3a3 in call_init (env=0x7fffffffe4c8, argv=0x7fffffffe4b8, argc=1, l=<optimized out>) at dl-init.c:82
#2 _dl_init (main_map=0x7ffff7ffe208, argc=1, argv=0x7fffffffe4b8, env=0x7fffffffe4c8) at dl-init.c:131
#3 0x00007ffff7ddc46a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#4 0x0000000000000001 in ?? ()
#5 0x00007fffffffe73b in ?? ()
#6 0x0000000000000000 in ?? ()

 

动态链接

标签:

原文地址:http://www.cnblogs.com/mengqingzhong/p/5517923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!