1. map 文件中.glue_7/.glue_7t是什么
Those stub sections are generated by the linker, not by gcc itself, so any documentation would be associated with the linker. That said, I don't think the GNU linker provides any documentation for them either.
The sections are named 'glue' because they glue together ARM and Thumb code. I assume the 7 is there because the ARM7 was the first one to support Thumb code. .glue_7 is used for ARM code calling Thumb code, and .glue_7t is used for Thumb code calling ARM code.
2. map 文件中.init/.finit是什么
.init这个section类似于构造函数,在main()函数之前执行
.fini这个section类似于析构函数,在main()函数退出之后执行
参考:(1条消息) crt1.o,crti.o,crtbegin.o,crtend.o ,crtn.o 与libc.so 的关系_Farmwang的博客-CSDN博客
(1条消息) 编译链接实战(12)crt1.o, crti.o, crtbegin.o, crtend.o, crtn.o是什么东西_奇妙之二进制的博客-CSDN博客
(1条消息) 两个特殊的段.init和.finit_.init .fini_萝卜2305的博客-CSDN博客
3. map 文件中.plt 、.rel.dyn、.rel.plt、.got.plt是什么
.plt的作用是一个跳板,保存了某个符号在重定位表中的偏移量(用来第一次查找某个符号)和对应的.got.plt的对应的地址
.rel.dyn重定向表,在程序启动时就需要重定位完成。
.rel.plt保存了重定位表的信息,可以使用lazy的连接方式
.got据说是保存了elf文件本身的各个符号的偏移量,即不要动态链接,未证明
.got.plt保存了重定位地址。
比如printf是一个重定位符号,需要连接该符号时过程是这样:
main函数call .plt段中的一个地址,这里的第一句话就是调转到.got.plt中的保存的printf的地址,如果是第一次,那么保存的地址就是.plt中的下一句话,这个下一句话就是压入这个符号在.rel.plt中的重定位表的偏移量,然后ld程序就会根据重定位表中的信息加上这个偏移量找到这个地址,保存到重定位表所指向的地址中,这个地址其实就是.got.plt段的一个地址。
第二次调用时就可以直接获取到.got.plt中保存的地址了
4.