Only add sanitizer runtimes when linking an executable (#64629).
Only add sanitizer runtimes when linking an executable (#64629).

graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust