This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Change NanoTime to use clock_gettime on non-glibc
ClosedPublic

Authored by MaskRay on Mar 6 2021, 11:26 AM.

Details

Summary

This avoids the __NR_gettimeofday syscall number, which does not exist on 32-bit musl (it has __NR_gettimeofday_time32).

This switched Android to clock_gettime as well, which should work according to the old code before D96925.

Tested on Alpine Linux x86-64 (musl) and FreeBSD x86-64.

Diff Detail

Event Timeline

MaskRay created this revision.Mar 6 2021, 11:26 AM
MaskRay updated this revision to Diff 328805.Mar 6 2021, 12:16 PM
MaskRay retitled this revision from [sanitizer] Make NanoTime work with musl to [sanitizer] Change NanoTime to use clock_gettime on non-glibc.
MaskRay edited the summary of this revision. (Show Details)

.

MaskRay published this revision for review.Mar 6 2021, 12:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2021, 12:17 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
MaskRay edited the summary of this revision. (Show Details)

Looks ok for NetBSD.

vitalybuka accepted this revision.Mar 10 2021, 10:34 PM
This revision is now accepted and ready to land.Mar 10 2021, 10:34 PM