Skip to content

Fix emutls crash on macOS ARM64#23

Closed
Icehunter wants to merge 1 commit into
minecraft-linux:masterfrom
Icehunter:feature/gameactivity-macos-support
Closed

Fix emutls crash on macOS ARM64#23
Icehunter wants to merge 1 commit into
minecraft-linux:masterfrom
Icehunter:feature/gameactivity-macos-support

Conversation

@Icehunter

@Icehunter Icehunter commented Mar 26, 2026

Copy link
Copy Markdown

Summary

Hooks __emutls_get_address to correct invalid alignment values that cause crashes on macOS ARM64. Some Android libraries (loaded via the mcpelauncher linker) use emulated TLS with alignment values that are not powers of two, which the host allocator rejects.

Changes

  • Adds emutls alignment validation and correction before allocation
  • Logs invalid alignment values for debugging

Testing

This fix is required alongside mcpelauncher-client PR minecraft-linux/mcpelauncher-client#136 for Minecraft 1.26.x on macOS ARM64.

# Build steps same as mcpelauncher-client PR #136
# This branch should be checked out for mcpelauncher-core submodule
cd mcpelauncher-core
git remote add pr https://github.com/Icehunter/mcpelauncher-core.git
git fetch pr feature/gameactivity-macos-support
git checkout pr/feature/gameactivity-macos-support

Without this fix, the game crashes during library loading with a SIGABRT from the allocator due to non-power-of-two alignment in emulated TLS control blocks.

Tested on Apple M5 Pro, macOS 26.3, Minecraft Bedrock 1.26.10.4.

https://www.youtube.com/watch?v=lBNuIqISYa4

Hooks __emutls_get_address to correct invalid alignment values that
cause crashes on macOS ARM64. Some Android libraries use emulated TLS
with alignment values that are not powers of two, which the host
allocator rejects. This corrects the alignment before allocation.
@Icehunter

Copy link
Copy Markdown
Author

This is also related to:

google/angle#103
KhronosGroup/MoltenVK#2702

Locally when I run everything after a build a get a substantial improvement in vibrant visuals, but i'm still fighting over some artifacts on/in water, and some leaf shading during the day.

@ChristopherHX

Copy link
Copy Markdown
Member

Is this PR a copy of #22 ??

@Icehunter

Copy link
Copy Markdown
Author

I actually didn't see that one sorry.

@Icehunter Icehunter closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants