如何解决LLVM IR为结构元素显示{} *
我一直在尝试为自定义Linux模块的功能指针找到所有可能的功能分配。但是,在某些情况下,LLVM IR显示结构包含{}*
类型作为元素。
问题是{}*
应该是上述结构中的函数指针:
%struct.file_operations = type {
%struct.module*,i64 (%struct.file*,i64,i32)*,i8*,i64*)*,i64 (%struct.kiocb*,%struct.iov_iter*)*,i32 (%struct.kiocb*,i1)*,i32 (%struct.file*,%struct.dir_context*)*,%struct.poll_table_struct*)*,i32,i64)*,%struct.vm_area_struct*)*,{}*,[...]
我碰巧通过索引14
访问该struct元素(摘录或LLVM IR格式化并缩短了相关性)。根据我为此使用的Linux内核版本,索引14
引用结构open
的{{1}}函数指针成员:
file_operations
通过查看LLVM IR(已为其分配我自己的struct file_operations {
[...]
int (*open) (struct inode *,struct file *);
[...]
}
函数)来确认它是open
函数指针:
lkm_open
为使我的LLVM分析正常工作,我需要此struct元素的正确类型,因为我认为这不是正确的类型...根据上面的store i32 (%struct.inode*,%struct.file*)* @lkm_open,i32 (%struct.inode*,%struct.file*)** bitcast ({}** getelementptr inbounds (%struct.lkm_state,%struct.lkm_state* @lkm_state,i64 0,i32 3,i32 14) to i32 (%struct.inode*,%struct.file*)**),align 8
指令,该类型不应为store
,但:
{}*
i32 (%struct.inode*,%struct.file*)*
在LLVM IR中是什么意思?为什么它是唯一用这种方式描述的struct成员(没有其他函数指针)?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。