Skip to content
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

Build failed on Apple M1 #1

Open
jserv opened this issue Dec 18, 2022 · 1 comment
Open

Build failed on Apple M1 #1

jserv opened this issue Dec 18, 2022 · 1 comment

Comments

@jserv
Copy link

jserv commented Dec 18, 2022

I attempted to build this project on Apple M1 powered MacBook.

clang main.c -I./src -Os -Wno-inline-asm -fPIC -o interp

Clang complained as following:

In file included from main.c:18:
In file included from ./src/interp.h:396:
./src/opcodes.h:27:1: error: unknown AArch64 fixup kind!
OP_IMPL_IMM(push, {
^
./src/opcodes.h:8:46: note: expanded from macro 'OP_IMPL_IMM'
    #define OP_IMPL_IMM(op,body)    OP(op, { GET_IMM(op_##op); body })
                                             ^
./src/interp.h:216:46: note: expanded from macro 'GET_IMM'
                                asm volatile("ldr %0, .IMM_" STRINGIFY(ID)                  EOL \
                                             ^
<inline asm>:1:2: note: instantiated into assembly here
        ldr x8, .IMM_op_push
        ^
...
6 errors generated.

Environment:

  • Apple clang version 14.0.0 (clang-1400.0.29.202)
  • macOS 13.1 (arm64)
@jserv
Copy link
Author

jserv commented Dec 21, 2022

Testing on Arm64 based Ubuntu Linux, I got the result below:

Initializing...
Generating Code @ 0xffff8ac0c000
Instructions: 1000000000
Code: 240 bytes
Segmentation fault

clang complained as following:

./src/opcodes.h:17:1: warning: maximum bytes expression exceeds alignment and has no effect [-Winline-asm]
OP_IMPL(dummy1, { asm("nop; #1"); })
^
./src/opcodes.h:7:37: note: expanded from macro 'OP_IMPL'
    #define OP_IMPL(op,body)        OP(op,body)
                                    ^
./src/interp.h:324:41: note: expanded from macro 'OP'
                                        ASM_ALIGN_NOP();                    \
                                        ^
./src/interp.h:296:49: note: expanded from macro 'ASM_ALIGN_NOP'
            #define ASM_ALIGN_NOP()         asm(".align " STRINGIFY(OP_ALIGN) ",,16")
                                                ^
<inline asm>:1:12: note: instantiated into assembly here
        .align 4,,16
                  ^

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

No branches or pull requests

1 participant