Don't add -lrt on Darwin for sanitized targets.
Bug: 34719251
Change-Id: Idf95c1bc12d6724ff2577f9fc4659930c0bd1501
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 0ccde97..4d74904 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -347,7 +347,10 @@
if ctx.Host() {
flags.CFlags = append(flags.CFlags, "-fno-sanitize-recover=all")
flags.LdFlags = append(flags.LdFlags, sanitizeArg)
- flags.LdFlags = append(flags.LdFlags, "-lrt", "-ldl")
+ if ctx.Os() == android.Linux {
+ flags.LdFlags = append(flags.LdFlags, "-lrt")
+ }
+ flags.LdFlags = append(flags.LdFlags, "-ldl")
// Host sanitizers only link symbols in the final executable, so
// there will always be undefined symbols in intermediate libraries.
_, flags.LdFlags = removeFromList("-Wl,--no-undefined", flags.LdFlags)