__do_global_dtors_aux和__do_global_ctors_aux [英] __do_global_dtors_aux and __do_global_ctors_aux

查看:1821
本文介绍了__do_global_dtors_aux和__do_global_ctors_aux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拆开用C ++编写一个简单的程序,有这两个函数名。我想这意味着构造函数构造函数和析构函数意味着析构函数,以及全球字也许意味着他们创建和销毁全局对象。我不能猜名辅助。什么这两个功能呢?

I disassembled a simple program written in C++ and there are these two function names. I guess that ctor means constructor and dtor means destructor, and word global maybe means that they create and destroy global objects. I cannot guess the name aux. What do these two functions do?

推荐答案

的地址的构造的析构函数分别存储在不同的章节中的 ELF可执行文件的。对于构造有一个叫 .CTORS 并在析构函数有在 .DTORS 部分章节。

The addresses of constructors and destructors of static objects are each stored in a different section in ELF executable. for the constructors there is a section called .CTORS and for the destructors there is the .DTORS section.

编译器创建了两个辅助性的功能 __ do_global_dtors_aux __ do_global_ctors_aux 调用这些静态对象的构造函数和析构函数。

the compiler creates two auxillary functions __do_global_dtors_aux and __do_global_ctors_aux for calling the constructors and destructors of these static objects.

__ do_global_ctors_aux 函数只执行的 .CTORS 部分走,而在 __ do_global_dtors_aux 做相同的工作只为。 DTORS 部分,其中包含指定的析构函数的程序。

__do_global_ctors_aux function simply performs a walk on the .CTORS section, while the __do_global_dtors_aux does the same job only for the .DTORS section which contains the program specified destructors functions.

这篇关于__do_global_dtors_aux和__do_global_ctors_aux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆