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):

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?的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)

    原文地址::http://blog.csdn.net/xiaolongwang2010/article/details/7550505 相关网帖 1.错误找不到WinsdkVer.h----http: ...

  5. VC++ : error LNK2005: ... already defined in *.obj

    今天写代码遇到了这么一个链接错误:"已经在*.obj中定义". error LNK2005: "void __cdecl ReplaceWstringVar(class ...

  6. Target runtime com.genuitec.runtime.generic.jee60 is not defined

    转载自:http://jingyan.baidu.com/article/d7130635338e3f13fdf47518.html 用eclipse加载别人的工程,报错Target runtime ...

  7. TOMCAT-报错The BASEDIR environment variable is not defined correctly

    <span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...

  8. MySql.Data.MySqlClient.MySqlException: Parameter ‘@maxid’ must be defined

    本文涉及到的mysql知识点: mysql中的if条件语句用法: IF(expr1,expr2,expr3) mysql使用变量(mysql中变量不用事前申明) mysql事务 testcase 为了 ...

  9. SQL SERVER中用户定义标量函数(scalar user defined function)的性能问题

    用户定义函数(UDF)分类  SQL SERVER中的用户定义函数(User Defined Functions 简称UDF)分为标量函数(Scalar-Valued Function)和表值函数(T ...

随机推荐

  1. 修改网卡缓存,解决Linux 网卡丢包严重问题

    Linux 网卡丢包严重 生产中有一台linux设备并发比较大,droped包比较多,尤其是在跑游戏数据包的时候,存在严重的丢包现象,怀疑网卡性能不足,在更换设备前想能不有通过软件方法解决,通过网上一 ...

  2. 复杂sql语句集锦

    本文主要讲一下笔者在工作中遇到的一些逻辑比较复杂的sql语句,下面是具体写法: SELECT IF ( LOCATE() , NULL, SUBSTRING( link, LOCATE() , IF ...

  3. Laravel中Session的使用

    以file为示例 1.Http request session方法$request->session()->put('key1','value1');echo $request->s ...

  4. 在业务控制方法中写入User,Admin多个模型收集参数

    1)  可以在业务控制方法中书写1个模型来收集客户端的参数 2)  模型中的属性名必须和客户端参数名一一对应 3)  这里说的模型不是Model对象,Model是向视图中封装的数据 @Controll ...

  5. Rvm 进行gem安装时必须输入密码Your user account isn't allowed to install to the system RubyGems 解决方案

    今天开发过程中,从master拉下代码后重启项目,想用控制台时,却发现需要密码??并且三次密码确认后还是疯狂报错. 当时第一想到是rvm版本不一致,随即则检查了版本跟gem生成,当确认rvm版本无误时 ...

  6. Linux安装配置JDK1.8

    JDK1.8 链接:http://pan.baidu.com/s/1nvGBzdR 密码:ziqb 1  在/usr/local   文件夹下新建一个文件夹software ,将JDK放到此文件夹中 ...

  7. Linux 查看CPU和内存的使用情况

    Linux 查看CPU和内存的使用情况 如何查看Linux机器的CPU和内存的使用情况. 可以通过如下方式: 1.查看CPU和内存的实时使用情况 使用如下命令: top 命令执行后,效果如下(资源的使 ...

  8. mysql安装报错error: Header V3 DSA signature: BAD, key ID

    CentOS安装rpm安装MySQL时爆出警告: warning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 ...

  9. Python 面向对象(上)

    一. 什么是面向对象? 1. 在了解面向对象之前,首先我们需要知道两个概念:(1)什么是函数?函数是对功能或动作的一种封装.函数的语法结构如下: def func(arg1): '''函数的内部有函数 ...

  10. vue如何获取并操作DOM元素

    原文地址 方法一: 直接给相应的元素加id,然后再document.getElementById("id");获取,然后设置相应属性或样式 方法二: 使用ref,给相应的元素加re ...