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_handlereplacement/tracker example 1 - Testing
__dso_handlereplacement/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 ...
随机推荐
- POJ 2488 -- A Knight's Journey(骑士游历)
POJ 2488 -- A Knight's Journey(骑士游历) 题意: 给出一个国际棋盘的大小,判断马能否不重复的走过所有格,并记录下其中按字典序排列的第一种路径. 经典的“骑士游历”问题 ...
- Android局部更新(RecyclerView+ DiffUtil)
一 概述 DiffUtil是support-v7:24.2.0中的新工具类,它用来比较两个数据集,寻找出旧数据集->新数据集的最小变化量. 说到数据集,相信大家知道它是和谁相关的了,就是我的最爱 ...
- CentOS linux7 磁盘分区
常用命令 df [选项] [文件] -a 显示全部文件系统 -h 方便阅读方式显示 -l 只显示本地文件系统 -T 显示文件系统类型 fdisk /dev/sda1
- 计算机组成原理 — FPGA 现场可编程门阵列
目录 文章目录 目录 FPGA FPGA 的应用场景 FPGA 的技术难点 FPGA 的工作原理 FPGA 的体系结构 FPGA 的开发 FPGA 的使用 FPGA 的优缺点 参考文档 FPGA FP ...
- Python新利器之pipenv
前言 之前学习异步asyncio库的时候,因为asyncio库支持Python3.5以上的版本,而我的Ubuntu14.04只有Python3.4,虽然下载了Python3.6,但是想直接利用ipyt ...
- centos7.2 apollo1.7.1的搭建
1.准备工作 第一步:linux系统中配置好java环境安装参考地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-down ...
- c++ 调试信息输出
1. 把打印信息输出到指定的文件里. #include <stdio.h> #include <stdlib.h> freopen("log.txt", & ...
- AP注册
1.ac发现ap 两种模式:二层发现.三层发现 按ap与ac所处ip网段不同,可以把注册过程分为二层模式和三层模式: 两种模式均通过发送discovery报文进行,二层模式discovery报文仅在同 ...
- Windows配置jdk环境变量
配置环境变量 前置条件:已经安装jdk以及jre 操 作:右击"我的电脑"-->"属性"-->"高级系统设置"-->&qu ...
- React中this指向常用的2种修正方式
一.使用bind方法(构造函数内绑定) <!DOCTYPE html> <html> <head> <meta charset="utf-8&quo ...