GCC编译器、插件和结构
我有这样的场景:GCC编译器、插件和结构,c,gcc,gcc-plugins,C,Gcc,Gcc Plugins,我有这样的场景: int open_ext2 () {} int close_ext2 () {} int read_ext2 () {} int write_ext2 () {} const struct fs_callbacks FS = { open_file: open_ext2, close_file: close_ext2, read_bytes: read_ext2, write_bytes: write_ext2 }; void main()
int open_ext2 () {}
int close_ext2 () {}
int read_ext2 () {}
int write_ext2 () {}
const struct fs_callbacks FS = {
open_file: open_ext2,
close_file: close_ext2,
read_bytes: read_ext2,
write_bytes: write_ext2
};
void main(){
FS.close_file();
}
D.1796 = close_ext2;
D.1796 ();
当我看gimple表示时(使用-fdump tree all
编译)
我看到这样的情况:
int open_ext2 () {}
int close_ext2 () {}
int read_ext2 () {}
int write_ext2 () {}
const struct fs_callbacks FS = {
open_file: open_ext2,
close_file: close_ext2,
read_bytes: read_ext2,
write_bytes: write_ext2
};
void main(){
FS.close_file();
}
D.1796 = close_ext2;
D.1796 ();
我没有得到的是分配在哪里发生open\u文件:open\u ext2
我的问题
- GCC是如何做到这一点的
- 什么时候发生的
- 有没有办法计算出映射标签->成员函数
-fdump tree original raw
转储信息
使用GCC插件:
- 使用pass插件\u FINISH\u DECL
- 在GCC源代码中查看文件:
GCC/tree dfa.c
-fdump tree original raw
转储信息
使用GCC插件:
- 使用pass插件\u FINISH\u DECL
- 在GCC源代码中查看文件:
GCC/tree dfa.c