我的 c++filt 似乎不能正常工作,没有输出变化
My c++filt doesn't seem to work properly, no output changes
在我的 linux 上,我有一个 .cpp 文件
void f(){}
struct C{void f(){}};
我编译了它并将二进制文件串起来,尝试对函数名进行分解:
$c++filt __Z1gv
__Z1gv
$c++filt __ZN1C1fEv
__ZN1C1fEv
好吧,它似乎没有像我预期的那样工作。我在这里做错了什么吗?我是否必须添加一些字母或删除一些字母才能使其正常工作?
请注意这些名称是 clang 符号,似乎 c++filt 只适用于我的 gcc 版本?或者 c++filt 应该有更新的版本来支持这两种编译器?
您可能需要传递 -_
标志。
$ c++filt -_ __Z1gv
g()
$ c++filt -_ __ZN1C1fEv
C::f()
-_
--strip-underscore
On some systems, both the C and C++ compilers put an underscore in front of every name. For example, the C name "foo
" gets the low-level name "_foo
". This option removes the initial underscore. Whether c++filt
removes the underscore by default is target dependent.
在我的 linux 上,我有一个 .cpp 文件
void f(){}
struct C{void f(){}};
我编译了它并将二进制文件串起来,尝试对函数名进行分解:
$c++filt __Z1gv
__Z1gv
$c++filt __ZN1C1fEv
__ZN1C1fEv
好吧,它似乎没有像我预期的那样工作。我在这里做错了什么吗?我是否必须添加一些字母或删除一些字母才能使其正常工作?
请注意这些名称是 clang 符号,似乎 c++filt 只适用于我的 gcc 版本?或者 c++filt 应该有更新的版本来支持这两种编译器?
您可能需要传递 -_
标志。
$ c++filt -_ __Z1gv
g()
$ c++filt -_ __ZN1C1fEv
C::f()
-_
--strip-underscoreOn some systems, both the C and C++ compilers put an underscore in front of every name. For example, the C name "
foo
" gets the low-level name "_foo
". This option removes the initial underscore. Whetherc++filt
removes the underscore by default is target dependent.