Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't attempt to use makecontext()/swapcontext() on Android #7196

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,19 @@ size_t get_compiler_stack_size() {

namespace Internal {

#ifdef HALIDE_INTERNAL_USING_ASAN
// nothing
#if defined(HALIDE_INTERNAL_USING_ASAN) || defined(__ANDROID__)
// If we are compiling under ASAN, we will get a zillion warnings about
// ASAN not supporting makecontext/swapcontext and the possibility of
// false positives.
//
// If we are building for Android, well, it apparently doesn't provide
// makecontext() / swapcontext(), despite being posixy
#define MAKECONTEXT_OK 0
#else
#define MAKECONTEXT_OK 1
#endif

#if MAKECONTEXT_OK
namespace {
// We can't reliably pass arguments through makecontext, because
// the calling convention involves an invalid function pointer
Expand Down Expand Up @@ -722,10 +732,7 @@ void run_with_large_stack(const std::function<void()> &action) {
#else
// On posixy systems we have makecontext / swapcontext

#ifdef HALIDE_INTERNAL_USING_ASAN
// ... unless we are compiling under ASAN, in which case we
// will get a zillion warnings about ASAN not supporting makecontext/swapcontext
// and the possibility of false positives. Just skip the extra stack space, I guess?
#if !MAKECONTEXT_OK
action();
return;
#else
Expand Down