Modifying Address Sanitizer

Hello

I am willing to make changes in Address Sanitizer for experimentation. But as I am a naive user I am confused with the fact that if I make changes to Address Sanitizer do I have to rebuild the whole LLVM.

Could somebody please help me figure out a way in which I can make changes to address sanitizer and do not have to compile the whole LLVM.

It depends what kind of changes your doing and what kind of test you need to perform I guess.
AFAIK, ASAN is split between a transformation in LLVM and a runtime in compiler-rt.
Ultimately I expect that if you already have a build, and you need to rebuild the runtime or clang after changing something in the code, the incremental build should be “fast” (few seconds to a few tens of seconds).

Thank you for the response.

Suppose I want to make changes in the LLVM part of Address Sanitizer.
Is there still a way to test the changes made to address sanitizer as a standalone.

Also can a pass be run after Address Sanitizer Pass is ran, where I can access the variables created by address sanitizer [LLVM Code] so that I avoid making changes directly to the address sanitizer?

Thank you for the response.

Suppose I want to make changes in the LLVM part of Address Sanitizer.
Is there still a way to test the changes made to address sanitizer as a standalone.

I don’t know what you mean by "address sanitizer as a standalone”. If you change LLVM you need to rebuild it (or clang).

Also can a pass be run after Address Sanitizer Pass is ran, where I can access the variables created by address sanitizer [LLVM Code] so that I avoid making changes directly to the address sanitizer?

Yes, but it may not be doable (or straightforward) to perform your logic separately as a post-pass, and you’ll still to build some infrastructure to be able to inject your pass at this point. I’m not sure what gain is expected from this, I’m missing the goal?

I meant by “address sanitizer as a standalone” as testing address sanitizer pass without compiling whole LLVM. But I think I need to compile the whole LLVM for the changes made.

Just being inquisitive to see what all possibilities are there :slight_smile:

Thank you for your responses