Don't add -lrt on Darwin for sanitized targets.

Bug: 34719251

Change-Id: Iff81c4d891a2341a8152e5603391b55b0222ebd7
This commit is contained in:
Evgenii Stepanov 2017-06-07 15:46:40 -07:00
parent 3f050c8ea8
commit c6482d69c2
1 changed files with 4 additions and 1 deletions

View File

@ -351,7 +351,10 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
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)