#include<stdio.h>
void f()
{
}
__attribute__((constructor)) void before()
{
printf("Hello
");
}
安装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 ?? ()