paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Clang __usercall: towards native support for user defined calling conventions

Clang __usercall:迈向对用户定义调用约定的原生支持
FSE Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2022匹配度 2/10 · 该论文属于编译器和语言特性设计,聚焦于在 Clang 中支持用户自定义调用约定以辅助逆向工程,不涉及静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析,因此与用户的核心研究方向基本无关。引用 0 inbox
Jared Widberg, Sashank Narain, Yimin Chen
crossref: 2026-09-12

AI 速览

一句话:在 Clang 中实现 __usercall 属性,使 C/C++ 源码能以熟悉语法直接声明用户自定义调用约定,简化逆向工程中的函数对接。

在逆向工程中,与 C/C++ 函数对接对产品开发和安全研究都很有价值,但当目标函数采用用户自定义调用约定(user defined calling convention)时,由于缺乏充分且易用的工具支持,对接一直非常困难。本文设计并实现了 Clang __usercall,提供一种优雅且熟悉的语法,让程序员可直接在 C/C++ 源码中为函数指定自定义调用约定。工作的关键新颖点在于模仿最流行的语法形式,并改造 Clang 以服务于对接(interfacing)场景。初步用户研究表明,该方案在用户体验、所需代码行数等多个关键方面优于现有方案;Clang __usercall 也已被集成到 Compiler Explorer 网站中。

问题
逆向工程中需要与使用用户自定义调用约定的 C/C++ 函数对接,但现有工具不足且不友好,难以在源码层面便捷地表达这类调用约定。
方法
设计并实现 Clang 的 __usercall 属性,模仿流行语法为 C/C++ 函数声明用户自定义调用约定,并改造 Clang 以支持对接用途。
评估
通过初步用户研究,在用户体验和所需代码行数等关键方面与现有方案对比;并将实现发布到 Compiler Explorer 供使用。
原文摘要(Abstract)

In reverse engineering interfacing with C/C++ functions is of great interest because it provides much more flexibility for product development and security purpose. However, it has been a great challenge when interfacing functions with user defined calling conventions due to the lack of sufficient and user-friendly tooling. In this work, we design and implement Clang __usercall, which aims to provide programmers with an elegant and familiar syntax to specify user defined calling conventions on functions in C/C++ source code. Our key novelties lie in mimicing the most popular syntax and adapting Clang for interfacing purpose. Our preliminary user study shows that our solution outperforms the existing ones in multiple key aspects including user experience and required lines of code. Clang __usercall is already added to the Compiler Explorer website as well.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot6959,
  title = {Clang __usercall: towards native support for user defined calling conventions},
  author = {Jared Widberg and Sashank Narain and Yimin Chen},
  booktitle = {FSE},
  year = {2022},
  doi = {10.1145/3540250.3558921}
}