Skip to content

Comments

Tracking Mac arm64 changes changes#2

Open
frink wants to merge 5 commits intofrinknet:mainfrom
dcherrera:main
Open

Tracking Mac arm64 changes changes#2
frink wants to merge 5 commits intofrinknet:mainfrom
dcherrera:main

Conversation

@frink
Copy link
Contributor

@frink frink commented Feb 8, 2026

@dcherrera contacted me offline to tell me about this fork but forgot to do a proper PR. This is tracking so we can dialog.

- Fixed duplicate syscall enum entries in darwin_generic.h
- Fixed #ifdef syntax error in arch/arm64.h
- Added Darwin-specific getcwd() using fcntl F_GETPATH
- Added posix_fadvise/posix_fallocate stubs for Darwin
- Fixed sched_yield for Darwin (no SYS_sched_yield)
- Fixed pthread thread termination syscall name
- Added missing renameat() function wrapper
- Fixed Mach-O section format for JACL_INIT_SECTION
- Added ARM64-specific atomic operations (ldxr/stxr)
- Fixed format_macho.h X-macro syntax errors
- Fixed Darwin symbol underscore prefix in _start assembly
- Fixed void function return value issues in core/stdlib.h

43/46 unit tests now pass on macOS ARM64
- Add errno definitions for WASM/JSRUN/WASI targets
- Add JACL_LDBL_BITS for WASM (128-bit long double)
- Create x/jsrun_wasm.h with syscall definitions
- Create x/signals_jsrun.h with signal macros
- Fix math.h function ordering (trunc before fmod)
- Fix circular dependency in rmodes (use bitwise instead of fmod)
- Add renameat() wrapper to stdio.h
- Add snprintf forward declaration to stdlib.h
Merges fix/darwin-arm64-support branch which adds:
- Fixed duplicate syscall enum entries in darwin_generic.h
- Fixed #ifdef syntax error in arch/arm64.h
- Added Darwin-specific getcwd() using fcntl F_GETPATH
- Added posix_fadvise/posix_fallocate stubs for Darwin
- Fixed sched_yield for Darwin (no SYS_sched_yield)
- Fixed pthread thread termination syscall name
- Added ARM64-specific atomic operations (ldxr/stxr)
- Fixed Mach-O section format and symbol underscore prefix
- Fixed void function return value issues in core/stdlib.h

Combined with WASM fixes already on main for full cross-platform support.
@dcherrera
Copy link

let me know how you would like me to split this up for your sanity and i will get on it...i think i actauly have more that was needed to get this working for another of our projects

@frink
Copy link
Contributor Author

frink commented Feb 8, 2026

I added a lot of comments here. Generally looks good but there is way more than needed here.

All I want is the Mac/ARM stuff initially. That I'll merge, if it's done properly.

The Math stuff I'm pretty protective of. I've been over this with a fine tooth comb and so something major like removing food is striking and needs to be argued well before I can allow it.

The stuff where the X files are modified is a genuine problem. All the awk files in utils generate those and the .h files should be left alone. I should probably make that more CLEAR in the file headers.

If you're creating a special helper for a single Arch you're probably doing it wrong and making the whole thing brittle. I'd like to know why you weren't voiding the thing either after return or voiding it in the function. You shouldn't have two helpers that do the same thing with different return types.

The JSRUN stuff is overkill right now. You're building a Bridge to nothing. That's why it's stubbed. That was intentional. The entire os/jsrun.h needs to build out a lot of those things and the JS is complex. I've opted NOT to do all of those syscalls for now because most WASM will NEVER use the file system. However, in time I do want to build all of that out. Just needs to be done in about 20 PRs not one bloated mess.

Add missing pthread type definitions and function stubs for broader
compatibility. Add project guidelines file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants