Skip to content

Commit 9a193a5

Browse files
authored
Merge pull request #26 from soxfox42/fixin-time
Fix exporting symbols, calling C functions
2 parents aeb4871 + a336eca commit 9a193a5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

source/backends/arm64.d

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ class BackendARM64 : CompilerBackend {
262262
output ~= "sub x20, sp, #4096\n"; // 512 cells
263263
output ~= "mov x19, x20\n";
264264

265+
// jump to main
266+
output ~= "b __calmain\n";
267+
265268
// create functions for interop
266269
if (exportSymbols) {
267270
output ~= "
@@ -275,9 +278,6 @@ class BackendARM64 : CompilerBackend {
275278
ret
276279
";
277280
}
278-
279-
// jump to main
280-
output ~= "b __calmain\n";
281281
}
282282

283283
override void End() {
@@ -426,6 +426,7 @@ class BackendARM64 : CompilerBackend {
426426
output ~= format("ldr x%d, [x19, #-8]!\n", reg);
427427
}
428428

429+
output ~= "and sp, x20, ~0xf\n";
429430
output ~= format("bl %s\n", ExternSymbol(word.symbolName));
430431

431432
if (!word.isVoid) {

source/backends/x86_64.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ class BackendX86_64 : CompilerBackend {
290290
// copy static array constants
291291
output ~= "call __copy_arrays\n";
292292

293+
// jump to main
294+
output ~= "jmp __calmain\n";
295+
293296
// create functions for interop
294297
if (exportSymbols) {
295298
output ~= "
@@ -304,9 +307,6 @@ class BackendX86_64 : CompilerBackend {
304307
ret
305308
";
306309
}
307-
308-
// jump to main
309-
output ~= "jmp __calmain\n";
310310
}
311311

312312
override void End() {

0 commit comments

Comments
 (0)