leonardchan updated this revision to Diff 349712. leonardchan added a comment.
In D103564#2795287 <https://reviews.llvm.org/D103564#2795287>, @mcgrathr wrote: > I think probably the better refactoring here would be to split this file in > two: one containing just the allocation functions; and a second with > everything else. > On Fuchsia, we'll use the allocation functions but none of the rest of it. > So the second whole file could just be under `#if !SANITIZER_FUCHSIA`. I don't think we can move the `__sanitizer_*` allocation functions since they're used for aliases for their libc equivalents which require definitions in the same TU: /usr/local/google/home/leonardchan/llvm-monorepo/llvm-project-4/compiler-rt/lib/hwasan/hwasan_interceptors.cpp:59:1: error: alias must point to a defined variable or function INTERCEPTOR_ALIAS(void *, aligned_alloc, SIZE_T alignment, SIZE_T size); ^ /usr/local/google/home/leonardchan/llvm-monorepo/llvm-project-4/compiler-rt/lib/hwasan/hwasan_interceptors.cpp:53:7: note: expanded from macro 'INTERCEPTOR_ALIAS' ALIAS("__sanitizer_" #FN); \ ^ Perhaps it might just be easier to just wrap the part of `hwasan_interceptors.cpp` that don't include the allocation functions with `#if !SANITIZER_FUCHSIA`, or as @eugenis suggested wrap the fork interceptor with `#if SANITIZER_ANDROID`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103564/new/ https://reviews.llvm.org/D103564 Files: compiler-rt/lib/hwasan/hwasan_interceptors.cpp Index: compiler-rt/lib/hwasan/hwasan_interceptors.cpp =================================================================== --- compiler-rt/lib/hwasan/hwasan_interceptors.cpp +++ compiler-rt/lib/hwasan/hwasan_interceptors.cpp @@ -21,6 +21,7 @@ #include "hwasan_thread.h" #include "hwasan_poisoning.h" #include "hwasan_report.h" +#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h" #include "sanitizer_common/sanitizer_platform_limits_posix.h" #include "sanitizer_common/sanitizer_allocator.h" #include "sanitizer_common/sanitizer_allocator_interface.h" @@ -175,6 +176,7 @@ return hwasan_malloc(size, &stack); } +#if !SANITIZER_FUCHSIA #if HWASAN_WITH_INTERCEPTORS #define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ extern "C" SANITIZER_INTERFACE_ATTRIBUTE RET WRAP(FN)(ARGS) \ @@ -346,3 +348,11 @@ inited = 1; } } // namespace __hwasan + +#else // !SANITIZER_FUCHSIA + +namespace __hwasan { +void InitializeInterceptors() {} +} // namespace __hwasan + +#endif // !SANITIZER_FUCHSIA
Index: compiler-rt/lib/hwasan/hwasan_interceptors.cpp =================================================================== --- compiler-rt/lib/hwasan/hwasan_interceptors.cpp +++ compiler-rt/lib/hwasan/hwasan_interceptors.cpp @@ -21,6 +21,7 @@ #include "hwasan_thread.h" #include "hwasan_poisoning.h" #include "hwasan_report.h" +#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h" #include "sanitizer_common/sanitizer_platform_limits_posix.h" #include "sanitizer_common/sanitizer_allocator.h" #include "sanitizer_common/sanitizer_allocator_interface.h" @@ -175,6 +176,7 @@ return hwasan_malloc(size, &stack); } +#if !SANITIZER_FUCHSIA #if HWASAN_WITH_INTERCEPTORS #define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ extern "C" SANITIZER_INTERFACE_ATTRIBUTE RET WRAP(FN)(ARGS) \ @@ -346,3 +348,11 @@ inited = 1; } } // namespace __hwasan + +#else // !SANITIZER_FUCHSIA + +namespace __hwasan { +void InitializeInterceptors() {} +} // namespace __hwasan + +#endif // !SANITIZER_FUCHSIA
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits