gpt4 book ai didi

linux - 什么时候使用 .fini_array 部分?

转载 作者:太空狗 更新时间:2023-10-29 11:13:54 25 4
gpt4 key购买 nike

我正在关注 http://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/编写一个只有 printf() 调用的网络服务器。

我正在遵循文章的指导。

但是,在objdump的帮助下,我发现我的程序的可执行文件不包含.fini_array部分。

注意到 .fini_array 是由 Linux Standard Base Core Specification 定义的。

我读了它,我很好奇 .fini_array 部分和 .fini 部分之间的关​​系,它们如何协同工作?

似乎不需要 .fini_array。那么什么时候使用,我该如何继续工作呢?

最佳答案

来自 http://docs.oracle.com/cd/E19683-01/817-1983/6mhm6r4es/index.html :

The runtime linker executes functions whose addresses are contained in the .fini_array section. These functions are executed in the reverse order in which their addresses appear in the array. The runtime linker executes a .fini section as an individual function. If an object contains both .fini and .fini_array sections, the functions defined by the .fini_array section are processed before the .fini section for that object.

所以 fini_array 是可选的,并且是 fini 的一种高级版本。

关于linux - 什么时候使用 .fini_array 部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26292964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com