ASM x64

  • 配置
    ASM x64 配置

  • Compile script

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    compname=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*/\1/'`
    /usr/local/bin/nasm -fmacho64 "$CR_FILENAME" -o "$CR_TMPDIR/$CR_FILENAME.o"
    status=$?
    if [ $status -ne 0 ]
    then
    exit 1
    fi
    ld "$CR_TMPDIR/$CR_FILENAME.o" -o "$compname" -macosx_version_min 10.7
    if [ $status -ne 0 ]
    then
    exit 1
    fi
    echo $compname
    exit 0
  • 模板

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    section .data
    hello_world db "Hello World!", 0x0a
    section .text
    global start
    start:
    mov rax, 0x2000004 ; System call write = 4
    mov rdi, 1 ; Write to standard out = 1
    mov rsi, hello_world ; The address of hello_world string
    mov rdx, 14 ; The size to write
    syscall ; Invoke the kernel
    mov rax, 0x2000001 ; System call number for exit = 1
    mov rdi, 0 ; Exit success = 0
    syscall ; Invoke the kernel

C->ASM(ARM)

  • 配置
    ASM ARM配置

  • compile flag

    1
    -std=gnu99 -Wall -Wno-missing-braces -Wno-unused-function
  • compile script

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    compname=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*/\1/'`
    clang "$CR_FILENAME" -isysroot `xcode-select --print-path`/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -arch armv7 -fverbose-asm -S -o "$compname" $CR_TMPDIR
    status=$?
    if [ $status -eq 0 ]
    then
    echo $compname
    exit 0
    elif [ $status -eq 127 ]
    then
    echo "Make sure you have installed GCC through the Xcode installer. If you have GCC or another compiler installed and you still get this error, you need to update the command above in the compilation script (see preferences) to reflect the full path of the executable."
    fi
    exit $status
  • 模板

Kotlin

  • 配置
    Kotlin

  • compile script

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    compname=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*/\1/'`
    #kotlinc hello.kt -include-runtime -d hello.jar
    kotlinc "$CR_FILENAME" -include-runtime -d "$compname.jar"
    status=$?
    if [ $status -ne 0 ]
    then
    exit 1
    fi
    echo "java -jar $compname.jar"
    exit 0
  • 模板

    1
    2
    3
    fun main(args: Array<String>) {
    println("Hello, World!")
    }