-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli/trampolines]: Fix
aarch64-apple-darwin
trampoline ASM syntax
It turns out that aarch64 assembly syntax uses `;` as the comment character, not as the statement separator. So we need to polyfill that. We also set an alignment of 4 bytes (`2^2`) which is required on Apple targets, but is also a good idea on most other aarch64 machines.
- Loading branch information
1 parent
ea39b70
commit cdb0833
Showing
2 changed files
with
27 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
#include "../../src/jl_exported_funcs.inc" | ||
|
||
// On macOS, we need to prepend underscores on symbols | ||
#if defined(__APPLE__) && defined(__MACH__) | ||
#define CNAME(x) _##x | ||
#define PAGE(x) x##@PAGE | ||
#define PAGEOFF(x) x##@PAGEOFF | ||
#define SEP %% | ||
#else | ||
#define CNAME(x) x | ||
#define PAGE(x) x | ||
#define PAGEOFF(x) #:lo12:##x | ||
#define SEP ; | ||
#endif | ||
|
||
#define XX(name) \ | ||
.global name; \ | ||
.cfi_startproc; \ | ||
name##:; \ | ||
adrp x0, name##_addr; \ | ||
ldr x0, [x0, #:lo12:name##_addr]; \ | ||
br x0; \ | ||
.cfi_endproc; \ | ||
.global CNAME(name) SEP \ | ||
.cfi_startproc SEP \ | ||
.p2align 2 SEP \ | ||
CNAME(name)##: SEP \ | ||
adrp x0, PAGE(CNAME(name##_addr)) SEP \ | ||
ldr x0, [x0, PAGEOFF(CNAME(name##_addr))] SEP \ | ||
br x0 SEP \ | ||
.cfi_endproc SEP \ | ||
|
||
JL_EXPORTED_FUNCS(XX) | ||
#undef XX |