Update for building on modern systems, including Apple Silicon#2
Merged
Sorixelle merged 6 commits intopebble-dev:masterfrom Feb 19, 2025
Sorixelle:modern-build-support
Merged
Update for building on modern systems, including Apple Silicon#2Sorixelle merged 6 commits intopebble-dev:masterfrom Sorixelle:modern-build-support
Sorixelle merged 6 commits intopebble-dev:masterfrom
Sorixelle:modern-build-support
Conversation
Member
Author
|
It's probably worth tagging this as 2.5.0-pebble5 if merged - should I update the version in this commit or will that happen after this is merged? |
macOS on Apple Silicon does not allow memory pages to be marked as RWX. Instead, to achieve the same behaviour, pages be allocated with the MAP_JIT flag, and the permissions are dynamically switched between RW and RX using the pthread_jit_write_protect function.[1] Most of this commit is derived from upstream work in [2], with changes as necessary to apply onto this older tree. [1]: https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon [2]: https://gitlab.com/qemu-project/qemu/-/commit/653b87eb36045b506b79f0bb433016ef1c54bc9a Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
At some point, sys/memfd.h was removed from most systems.[1] Instead, the definitions we need from it can now be found in sys/mman.h. [1]: https://stackoverflow.com/questions/56615488/getting-gcc-error-sys-memfd-h-no-such-file-or-directory Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
Without these includes, the build fails on some systems due to missing declarations for qemu_system_reset_request, which live in sysemu/sysemu.h. Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
Similarly to 745fb61, it seems some definitions may have been moved around in the C stdlib, and accessing major requires explicitly including sys/sysmacros.h. Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
Somewhere in the macOS build, there's an #include for <version>. Because the root source directory is added to the include path during build, that include picks up this VERSION file, which makes the build fail since it doesn't contain valid C code. Renaming the file to prevent the name collision allows the build to proceed as normal. Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
All of the old submodules are currently dead, either because of dropping support for the old git:// scheme (like GitHub), or because the repos have been moved to a new location. Signed-off-by: Ruby Iris Juric <ruby@srxl.me>
|
Works for me. We'd have to create and push a new tag after this is merged. Also we might want to mention that unlike the FW, Python 2 is required to build this. |
Member
Author
|
It should be pretty trivial to port these scripts to Python 3, especially since there's no external dependencies - |
SteveUcho
pushed a commit
to SteveUcho/pebble-qemu
that referenced
this pull request
May 7, 2025
Address a memory leak bug in the usages of timer_del().
The issue arises from the incorrect use of the ambiguous timer API
timer_del(), which does not free the timer object. The LeakSanitizer
report this issue during fuzzing. The correct API timer_free() freed
the timer object instead.
=================================================================
==2586273==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x55f2afd89879 in calloc /llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:75:3
pebble-dev#1 0x7f443b93ac50 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5ec50)
pebble-dev#2 0x55f2b053962e in timer_new include/qemu/timer.h:542:12
pebble-dev#3 0x55f2b0514771 in timer_new_us include/qemu/timer.h:582:12
pebble-dev#4 0x55f2b0514288 in lsi_scsi_realize hw/scsi/lsi53c895a.c:2350:24
pebble-dev#5 0x55f2b0452d26 in pci_qdev_realize hw/pci/pci.c:2174:9
Signed-off-by: Zheng Huang <hz1624917200@outlook.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <73cd69f9-ff9b-4cd4-b8aa-265f9d6067b9@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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.
This PR is an upstream of the patches in https://github.com/Sorixelle/pebble.nix/tree/main/derivations/pebble-qemu that allow this repo to be built, and the resulting binaries to be run on modern systems, particularly Apple Silicon macOS systems. All of this is generally useful outside of a Nix environment, so it would be nice to have here so anyone can build this repo easily if they need to.