<div dir="ltr">Hi all,<div><br></div><div>I noticed that some asan-instrumented binaries varied in size depending on the length of my build path despite using `-ffile-prefix-map`. I discovered that asan bakes in the absolute path of whatever I'm compiling through the module ID (<a href="https://github.com/llvm/llvm-project/blob/80397d2d12b042586cb3bafdeb12ef8d982b8875/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp#L2254">https://github.com/llvm/llvm-project/blob/80397d2d12b042586cb3bafdeb12ef8d982b8875/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp#L2254</a>) which is currently unaffected by `-ffile-prefix-map`. This means binaries shipped in asan-instrumented toolchains, like libunwind, may vary depending on where it's built.</div><div><br></div><div>From what I see, there doesn't seem to be an existing way of indicating to asan that I'd like to map prefixes, so I have a couple of implementation ideas that I wanted to see if people had opinions on:</div><div><br></div><div>1. Have a separate flag orthogonal to `-fmacro-prefix-map` and `-fdebug-prefix-map` that controls which paths sanitizers (or at least asan) use. This can be named something like `-fsanitizer-prefix-map` and would also be turned on when `-ffile-prefix-map` is used.</div><div><br></div><div>2. Same as 1, but we wouldn't be adding a new flag (`-fsanitizer-prefix-map`) and the sanitizers would just use whatever value is passed to `-ffile-prefix-map`.</div><div><br></div><div>3/4. Same as 1/2, but instead of catching this at sanitizer creation, we catch this on llvm::Module creation, so anything that calls `Module::getModuleIdentifier()` will always return a path whose prefix was replaced according to whatever appropriate mapping.</div><div><br></div><div>Thanks,</div><div>Leonard</div></div>