Skip to content

Fix mpy-cross build on Apple M1 machines #4835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions py/nlraarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@
// Implemented purely as inline assembly; inside a function, we have to deal with undoing the prologue, restoring
// SP and LR. This way, we don't.
__asm(
#if defined(__APPLE__) && defined(__MACH__)
"_nlr_push: \n"
".global _nlr_push \n"
#else
"nlr_push: \n"
".global nlr_push \n"
#endif
"mov x9, sp \n"
"stp lr, x9, [x0, #16]\n" // 16 == offsetof(nlr_buf_t, regs)
"stp x19, x20, [x0, #32]\n"
Expand All @@ -44,7 +49,11 @@ __asm(
"stp x25, x26, [x0, #80]\n"
"stp x27, x28, [x0, #96]\n"
"str x29, [x0, #112]\n"
#if defined(__APPLE__) && defined(__MACH__)
"b _nlr_push_tail \n" // do the rest in C
#else
"b nlr_push_tail \n" // do the rest in C
#endif
);

NORETURN void nlr_jump(void *val) {
Expand Down