interp icon indicating copy to clipboard operation
interp copied to clipboard

Build failed on Apple M1

Open jserv opened this issue 2 years ago • 1 comments

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 avatar Dec 18 '22 21:12 jserv

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
                  ^

jserv avatar Dec 21 '22 16:12 jserv