[clang] [Clang][Driver] Link ASan into user binaries when the HIP runtime is ASan (PR #222402)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 5 16:52:10 PDT 2026
jhuber6 wrote:
I think a lot of these problems are caused by how HIP handles ASan. Normally, ASan is intended to work in a program regardless of which pieces were compiled with `-fsanitize=address` and leaving it off for the link will just be a linker error. Normally, all the guts of the logic lives in `compiler-rt`, but we split it up between the HIP runtime and `compiler-rt`. A better solution would just be to pull this logic out of `rocm-systems` entirely and handle it in `compiler-rt` like I do with the other sanitizers I'm working. The only hairy bit there is the `ROCt` logic that handles the implicit host mapping of the metadata chunk, only required because the `compiler-rt` implementation routes HSA through the same allocation interface that `malloc` uses instead of writing it custom. That, combined with various hacks on the device side to keep the backwards linking from breaking.
> OTOH, this is a pretty niche bug, so if you think just giving a warning at the library level is more feasible than adding a mitigation at the compiler level, I'm open to hearing you out on that.
I'm definitely leaning more towards a "mitigate pending a proper rewrite." So I'd be fine with that.
https://github.com/llvm/llvm-project/pull/222402
More information about the cfe-commits
mailing list