c – Itanium和MSVC ABI中跨模块边界的RTTI

c – Itanium和MSVC ABI中跨模块边界的RTTI,第1张

概述我正在阅读 Itanium ABI It is intended that two type_info pointers point to equivalent type descriptions if and only if the pointers are equal. An implementation must satisfy this constraint, e.g. by using 我正在阅读 Itanium ABI

It is intended that two type_info pointers point to equivalent type descriptions if and only if the pointers are equal. An implementation must satisfy this constraint,e.g. by using symbol preemption,COMDAT sections,or other mechanisms.

有没有人知道在使用动态加载的库时,在使用GCC和GNU binutils的linux等流行平台上如何实现这一点的血腥细节?它有多可靠?

另外,我对MSVC中的typeID比较的印象是(使用?)在错位符号名称上使用运行时字符串比较,因为无法保证满足此要求.这仍然是它的方式吗?是否有技术平台限制阻止MSVC使用与Itanium ABI平台相同的技术?

编辑还有一个问题:跨越模块边界的异常(在ABI中)是否也依赖于RTTI信息,或者除了相当于运行时dynamic_casts之外还有其他机制吗?

解决方法 MSVC首先使用指针比较,然后,如果失败,则比较字符串.您可以在VS2012的CRT源中看到实现:

extern "C" _CRTIMP int __cdecl __TypeMatch(    HandlerType *pCatch,// Type of the 'catch' clause    CatchableType *pCatchable,// Type conversion under consIDeration    ThrowInfo *pThrow                   // General information about the thrown                                        //   type.) {    // First,check for match with ellipsis:    if (HT_IS_TYPE_ELliPSIS(*pCatch)) {        return TRUE;    }    // Not ellipsis; the basic types match if it's the same record *or* the    // names are IDentical.    if (HT_PTD(*pCatch) != CT_PTD(*pCatchable)      && strcmp(HT_name(*pCatch),CT_name(*pCatchable)) != 0) {        return FALSE;    }    ...

Itanium ABI始终仅使用指针比较.它应该与DLL一起使用的方式是动态加载器应该确保在程序的地址空间中存在每个异常的typeinfo对象的单个实例.

如果您对RTTI异常的实际实现和捕获信息感兴趣,请查看我的OpenRCE article(MSVC)和Recon 2012 presentation(GCC,MSVC x64).

总结

以上是内存溢出为你收集整理的c – Itanium和MSVC ABI中跨模块边界的RTTI全部内容,希望文章能够帮你解决c – Itanium和MSVC ABI中跨模块边界的RTTI所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1226579.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-05
下一篇2022-06-05

发表评论

登录后才能评论

评论列表(0条)

    保存