Guard fork/execvp in AOT builder for sandboxed platforms#53
Open
lancejpollard wants to merge 1 commit intoHigherOrderCO:mainfrom
Open
Guard fork/execvp in AOT builder for sandboxed platforms#53lancejpollard wants to merge 1 commit intoHigherOrderCO:mainfrom
lancejpollard wants to merge 1 commit intoHigherOrderCO:mainfrom
Conversation
Wrap aot/build.c in #ifdef guards for platforms where fork() and execvp() are unavailable (WASM, iOS, Android). Stub functions print a clear error. Existing desktop/server builds are unchanged.
895340f to
c4c55be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wraps
aot/build.cin#ifdefguards so HVM4 compiles on platforms wherefork()andexecvp()are unavailable.Benefits
HVM_NO_AOT_BUILDfor other restricted environmentsChanges
clang/aot/build.c: Added a platform guard at the top of the file. On sandboxed platforms (__EMSCRIPTEN__,__ANDROID__,TARGET_OS_IPHONE, or user-definedHVM_NO_AOT_BUILD), the three public functions (aot_build_to_c,aot_build_as_c_once,aot_build_to_output) are replaced with stubs that print a clear error and exit. The#elsebranch contains the original code, unchanged.This avoids including
<sys/wait.h>,<unistd.h>, and other POSIX headers that don't exist on restricted platforms.Risk
None on existing platforms I don't think. The guard only triggers when one of the platform-specific defines is set. Desktop and server builds take the
#elsepath, which is the original code unchanged. AOT compilation (--to-c,--as-c,-o) is verified working after this change.