This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][hwasan] Check for SANITIZER_POSIX before including sanitizer_posix.h
ClosedPublic

Authored by leonardchan on Jul 28 2021, 11:07 AM.

Details

Summary

None of the functions declared in sanitizer_posix.h are needed for the Fuchsia implementation inside hwasan_dynamic_shadow.cpp.

Diff Detail

Event Timeline

leonardchan created this revision.Jul 28 2021, 11:07 AM
leonardchan requested review of this revision.Jul 28 2021, 11:07 AM

Not sure if this is the cleanest approach, but I'll leave it up to the reviewers. This really only affects the fuchsia case which just defines an empty InitShadowGOT.

vitalybuka added inline comments.Jul 28 2021, 11:14 AM
compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp
25 ↗(On Diff #362456)

I believe we usually do that inside of "sanitizer_common/sanitizer_posix.h"

#include "sanitizer_platform.h"
#if SANITIZER_POSIX

#SANITIZER_POSIX

E.g. sanitizer_common/sanitizer_win.h

vitalybuka accepted this revision.Jul 28 2021, 11:15 AM

LGTM if moved into sanitizer_posix.h

This revision is now accepted and ready to land.Jul 28 2021, 11:15 AM

LGTM if moved into sanitizer_posix.h

Done. Although before, including this header when SANITIZER_POSIX was 0 would result in the preprocessor error (shown in diff). Will still leave it up in case this changes anything, but will land this after a day or so if no further comments.