博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Where is __dso_handle defined?
阅读量:5374 次
发布时间:2019-06-15

本文共 2579 字,大约阅读时间需要 8 分钟。

Where is __dso_handle defined?

来源  

 

__dso_handle is a "guard" that is .

Realistically, you should stop reading here. If you're trying to defeat object identification by messing with __dso_handle, something is likely very wrong.

However, since you asked where it is defined: the answer is complex. To surface the location of its definition (for GCC), use iostream in a C++ file, and, after that, do extern int __dso_handle;. That should surface the location of the declaration due to a type conflict (see  for a source).

Sometimes, it is .

Sometimes, it is defined/supplied by the "runtime" installed by the compiler (in practice, the CRT is usually just a bunch of binary header/entry-point-management code, and some exit guards/handlers). In GCC (not sure if other compilers support this; if so, it'll be in their sources):

Often, it is defined in the stdlib:

Further reading:

   

 

 

__cxa_atexit and __dso_handle

  

 

 

crtbegin.c

/* Runtime support for C++ */typedef void (*func_ptr) (void);/* __dso_handle *//* Itanium C++ ABI requires that each shared object (*.so) should have its   own __dso_handle, and when that shared object is unloaded, the __dso_handle   is an argument that is passed to __cxa_finalize. For a shared object,   __dso_handle is assigned itself, for the main executable, __dso_handle is 0*/#ifdef SHAREDvoid *__dso_handle = &__dso_handle;#elsevoid *__dso_handle = 0;#endif#if 0#ifdef SHAREDextern void __cxa_finalize (void *) __attribute__((weak));static void __attribute__((used))__do_global_dtors_aux(void) {  static int completed;  if (__builtin_expect (completed, 0))    return;  if (__cxa_finalize)    __cxa_finalize (__dso_handle);  completed = 1;}__asm__ (".section .fini");__asm__ (".align 8, 0x90");__asm__ (".byte 0x0f, 0x1f, 0x00");__asm__ ("call __do_global_dtors_aux");#endif#endif/* The musl libc is responsible for init_array traversal so there is no   need to keep __do_global_ctors_aux*/#if 0static void __attribute__((used))__do_global_ctors_aux(void) {  static int completed;  if (__builtin_expect (completed, 0))    return;  completed = 1;}__asm__ (".section .init");__asm__ (".align 8, 0x90");__asm__ (".byte 0x0f, 0x1f, 0x00");__asm__ ("call __do_global_ctors_aux");#endif

 

#ifdef __cplusplusextern "C" {#endif // __cplusplus    extern __attribute__((weak)) void *__dso_handle;#ifdef __cplusplus}#endif // __cplusplus

 

undefined reference to `__dso_handle'  ?

If this is your use case then merely add the command line option to your compile/link command line: -fno-use-cxa-atexit

 

=============== End

 

转载于:https://www.cnblogs.com/lsgxeva/p/11040993.html

你可能感兴趣的文章
Spring框架基础(中)
查看>>
java文件的读写程序代码
查看>>
NOIP200703守望者的逃离
查看>>
SmbException: 0xC000007F
查看>>
UVA 12627 气球胀啊胀
查看>>
Apache 的ab压力测试工具
查看>>
linux进程状态D
查看>>
256.Paint House
查看>>
Java7中的文件和目录管理----Path类
查看>>
tarjan算法(割点/割边/点连通分量/边连通分量/强连通分量)
查看>>
windows下通过navicat for mysql连接centos6.3-64bit下的MySQL数据库
查看>>
创建单例
查看>>
Linux shell脚本编程基础之练习篇
查看>>
maven web项目build失败
查看>>
常用在线小工具
查看>>
canvas
查看>>
F2BPM流程中心RESTfull解决方案及示例
查看>>
关于Activiti的工作流选型
查看>>
Android WebView 实现网页缩放
查看>>
Maven的settings.xml文件结构之mirrors
查看>>