How to add llvm `__attribute__` to Rust functions?


I'm doing some fuzzer related proejct. In the llvm's sanitizer coverage, it allows __attribute__((no_sanitize("coverage"))) to ignore certain functions. I tried to search for it in Rust, it seems for now Rustc only allows few of attributes? Can you give me more reference about this problem?


1 Like

You can use #[no_coverage] with the no_coverage unstable feature as replacement for __attribute__((no_sanitize("coverage"))) in C. Note that all __attribute__ attributes are defined in clang, not LLVM. As such rustc has to manually implement them. It can't reuse clang's support.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.