Where is __dso_handle defined?
Where is __dso_handle defined?
来源 https://stackoverflow.com/questions/34308720/where-is-dso-handle-defined
__dso_handle
is a "guard" that is used to identify dynamic shared objects during global destruction.
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 this forum thread for a source).
Sometimes, it is defined manually.
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):
- Main definition
- Testing
__dso_handle
replacement/tracker example 1 - Testing
__dso_handle
replacement/tracker example 2
Often, it is defined in the stdlib:
Further reading:
__cxa_atexit and __dso_handle
https://lists.debian.org/debian-gcc/2003/07/msg00057.html
https://wiki.osdev.org/C++#GCC
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 SHARED
void *__dso_handle = &__dso_handle;
#else
void *__dso_handle = ;
#endif #if 0
#ifdef SHARED extern void __cxa_finalize (void *) __attribute__((weak)); static void __attribute__((used))
__do_global_dtors_aux(void) {
static int completed; if (__builtin_expect (completed, ))
return; if (__cxa_finalize)
__cxa_finalize (__dso_handle); completed = ;
} __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 0
static void __attribute__((used))
__do_global_ctors_aux(void) {
static int completed; if (__builtin_expect (completed, ))
return; completed = ;
} __asm__ (".section .init");
__asm__ (".align 8, 0x90");
__asm__ (".byte 0x0f, 0x1f, 0x00");
__asm__ ("call __do_global_ctors_aux");
#endif
#ifdef __cplusplus
extern "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
Where is __dso_handle defined?的更多相关文章
- unsupported dynamic reloc R_ARM_REL32 AND hidden symbol '__dso_handle' is not defined
项目里编译codec src\makefiles\android\codec\Makefileline 25 原本用 4.6 不会报错-L/data/android/android-ndk/sourc ...
- No result defined for action com.lk.IndexAction and result success
意图访问一个 /es/index.action 竟然出现: [SAE ] ERROR [05-11 13:54:32] [http-80-5] com.opensymphony.xwork2.util ...
- Apache报错信息之Invalid command 'Order', perhaps misspelled or defined by a module not included in the server config
今天配置开启Apache虚拟主机时, 然后日志报错提示: Invalid command 'Order', perhaps misspelled or defined by a module not ...
- _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
原文地址::http://blog.csdn.net/xiaolongwang2010/article/details/7550505 相关网帖 1.错误找不到WinsdkVer.h----http: ...
- VC++ : error LNK2005: ... already defined in *.obj
今天写代码遇到了这么一个链接错误:"已经在*.obj中定义". error LNK2005: "void __cdecl ReplaceWstringVar(class ...
- Target runtime com.genuitec.runtime.generic.jee60 is not defined
转载自:http://jingyan.baidu.com/article/d7130635338e3f13fdf47518.html 用eclipse加载别人的工程,报错Target runtime ...
- TOMCAT-报错The BASEDIR environment variable is not defined correctly
<span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...
- MySql.Data.MySqlClient.MySqlException: Parameter ‘@maxid’ must be defined
本文涉及到的mysql知识点: mysql中的if条件语句用法: IF(expr1,expr2,expr3) mysql使用变量(mysql中变量不用事前申明) mysql事务 testcase 为了 ...
- SQL SERVER中用户定义标量函数(scalar user defined function)的性能问题
用户定义函数(UDF)分类 SQL SERVER中的用户定义函数(User Defined Functions 简称UDF)分为标量函数(Scalar-Valued Function)和表值函数(T ...
随机推荐
- Flutter打开第三方应用
在flutter中打开第三方应用可以使用url_launcher插件 打开https://pub.dartlang.org/,然后搜索url_launcher,然后点击进入该插件界面 大家在insta ...
- Error, DNGuard Runtime library not loaded!
// Token: 0x06008CE9 RID: 36073 RVA: 0x0059629A File Offset: 0x00591E9A [MethodImpl(MethodImp ...
- Tomcat多实例集群架构 安全优化和性能优化
Tomcat多实例 复制tomcat目录 /usr/local/tomcat1 /usr/local/tomcat2 修改多实例配置文件 #创建多实例的网页根目录 mkdir -p /data/www ...
- mybatis之分页查询
1)StudentDao.java /** * 持久层*/ public class StudentDao { /** * 增加学生 */ public void add(Student studen ...
- JS中map()与forEach()的用法
相同点: 1.都是循环遍历数组中的每一项 2.每次执行匿名函数都支持三个参数,参数分别为item(当前每一项),index(索引值),arr(原数组) 3.匿名函数中的this都是指向window 4 ...
- nginx配置, 启动命令, 反向代理配置
2014年1月3日 13:52:07 喜欢这样的风格,干货 http://huoding.com/2013/10/23/290 -----------------下边是我自己的经验(windows)- ...
- AIX系统命令
当/oracle达到一定使用量时需清除*.trc文件find . -name "*.trc"|xargs rm -rf 1.查看是否开启归档日志切换用户:su - oracle使用 ...
- [ML] Online learning
复习 一.Spark 流处理 使用Spark Streaming与我们操作RDD的方式很接近,处理数据流也变得简单了.使用Spark的流处理元素结合MLlib的基于SGD的在线学习能力,可以创建实时的 ...
- 连接服务器VNC
1,启动vnc vncserver 2,提示输入密码 3,Would you like to enter a view-only password (y/n)? 选择n 4,会生成一个端口号 5, ...
- mybatis低版本jsr310(LocalDateTime,LocalDate等) Joda Time支持
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybati ...