This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Do not add -lpthread & -lrt with -static-libsan on Android
ClosedPublic

Authored by cryptoad on Jun 25 2018, 2:47 PM.

Details

Summary

I am not sure anyone has tried to compile an application with sanitizers on
Android with -static-libsan, and a recent NDK, but it fails with:

.../i686-linux-android/bin/ld.gold: error: cannot find -lpthread
.../i686-linux-android/bin/ld.gold: error: cannot find -lrt

My understanding is that both are included in Bionic and as such are not needed,
and actually error out.

So remove the addition of those two in linkSanitizerRuntimeDeps when dealing
with Android, and update the tests.

I am unfamiliar with the evolution of the NDK and I am not sure if this has
always been the case or if this is somewhat of a recent evolution. I'll let
Android people chime in.

Diff Detail

Event Timeline

cryptoad created this revision.Jun 25 2018, 2:47 PM
eugenis accepted this revision.Jun 25 2018, 2:54 PM

LGTM
This has always been the case.

This revision is now accepted and ready to land.Jun 25 2018, 2:54 PM
srhines accepted this revision.Jun 25 2018, 4:02 PM

Agree. This is the first time anyone is linking against static sanitizers on Android, so this is just something that we missed updating in the past.

cryptoad updated this revision to Diff 152900.Jun 26 2018, 9:18 AM

Rebasing.

This revision was automatically updated to reflect the committed changes.