GCC C ++名称修改参考 [英] GCC C++ Name mangling reference
问题描述
环顾四周,我主要看到有关拆解C ++符号而不是如何处理它们的问题.是的,可以使用-S
选项在某些包含要整改的符号的伪代码上调用g++
,然后检查生成的程序集,但是我无法找到有关GCC的良好参考或规范.名字改头换面.我能找到的最接近的东西是 http://www.int0x80.gr/papers/name_mangling.pdf ,但似乎并没有涵盖诸如名称模板实例化如何被篡改或_Z3fooIN3BarEE3FooIXT_EEv
为什么会转换为Foo<Bar> foo<Bar>()
的事情(尽管我可以看到,但是IXT_EE
到底是什么?为什么在此_Z
之后没有N
?这甚至意味着什么?).
Looking around, I see mostly questions about demangling C++ symbols rather than how to mangle them. Yes, one could invoke g++
, using the -S
option, on some dummy code containing the symbols to be mangled, and then examine the resulting assembly, but I haven't been able to find a good reference or specification on GCC's name mangling. The closest thing I could find was at http://www.int0x80.gr/papers/name_mangling.pdf, but it doesn't seem to cover things like how names template instantiations are mangled or why _Z3fooIN3BarEE3FooIXT_EEv
would translate into Foo<Bar> foo<Bar>()
(though I can kind of see how, but what the hell is IXT_EE
? Why is there no N
after the _Z
in this one? What's that even mean?).
推荐答案
Quote from gcc's sources(https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c):
此文件根据IA64 C ++实现对C ++名称的处理 ABI规范.
This file implements mangling of C++ names according to the IA64 C++ ABI specification.
这是此规范中的规则: https://itanium-cxx-abi.github.io/cxx -abi/abi.html#mangling
And here is the rules from this specification: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
这篇关于GCC C ++名称修改参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!