This is an archive of the discontinued LLVM Phabricator instance.

[Orc] Disable use of shared memory on Android
ClosedPublic

Authored by argentite on Jul 29 2022, 6:38 PM.

Details

Summary

shm_open and shm_unlink are not available on Android. This commit
disables SharedMemoryMapper on Android until a better solution is
available.

https://android.googlesource.com/platform/bionic/+/refs/heads/master/docs/status.md
https://github.com/llvm/llvm-project/issues/56812

Diff Detail

Event Timeline

argentite created this revision.Jul 29 2022, 6:38 PM
argentite requested review of this revision.Jul 29 2022, 6:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 6:38 PM
sgraenitz added a subscriber: sgraenitz.

Not sure about Lang's availability right now. I can sign this off as well if necessary.

llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
192

You have to pass a std::error_code here as well. Either try and find a matching standard error code or use llvm::inconvertibleErrorCode().

llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
63

As mentioned in the mail: SharedMemoryCount should be #ifdefed in the header. Otherwise it's a unused private field and triggers a warning / error (with -Werror).

sunho added a subscriber: sunho.Jul 30 2022, 2:10 PM

Would it make sense to make (defined(LLVM_ON_UNIX) && !defined(__ANDROID__)) || defined(_WIN32) another macro like LLVM_ORC_SHARED_MAPPER_SUPPORTED? The expression is being repeated a lot.

argentite updated this revision to Diff 448830.Jul 30 2022, 6:31 PM
argentite marked 2 inline comments as done.

Something like LLVM_ORC_SHARED_MAPPER_SUPPORTED would be nice and maybe we can even define it from the build system. In any case it should be a follow up patch I guess.

sunho added a comment.Jul 30 2022, 6:37 PM

Yup, feel free to move on as this is a hotfix.

sgraenitz accepted this revision.EditedJul 31 2022, 1:45 AM

Thanks, LGTM. Error in pre-merge checks is unrelated.

This revision is now accepted and ready to land.Jul 31 2022, 1:45 AM
This revision was landed with ongoing or failed builds.Aug 1 2022, 6:21 AM
This revision was automatically updated to reflect the committed changes.