diff options
| author | ruki <[email protected]> | 2020-05-24 21:10:49 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-24 21:10:49 +0800 |
| commit | fb2ba113ca1534249b0872002af0f133becd7e51 (patch) | |
| tree | d5bc9fb1553f622842712b18a7959a0c08a92d63 /tests | |
| parent | dd09a2264181f82a0b6aefb38dce5c92fb3af8fe (diff) | |
| parent | 5ad2eaee8cd65987359dbdfc5149bdd61b9260fc (diff) | |
Merge pull request #792 from xmake-io/toolchain
Improve to detect cross-compilation toolchains
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/projects/asm/fasm/src/main.S | 28 | ||||
| -rw-r--r-- | tests/projects/asm/fasm/xmake.lua | 3 | ||||
| -rw-r--r-- | tests/projects/asm/gas/src/main.S | 9 | ||||
| -rw-r--r-- | tests/projects/asm/gas/xmake.lua | 3 | ||||
| -rw-r--r-- | tests/projects/asm/nasm/src/main.S | 20 | ||||
| -rw-r--r-- | tests/projects/asm/nasm/xmake.lua | 3 | ||||
| -rw-r--r-- | tests/projects/asm/yasm/src/main.S | 20 | ||||
| -rw-r--r-- | tests/projects/asm/yasm/xmake.lua | 3 |
8 files changed, 89 insertions, 0 deletions
diff --git a/tests/projects/asm/fasm/src/main.S b/tests/projects/asm/fasm/src/main.S new file mode 100644 index 000000000..90f4b88b4 --- /dev/null +++ b/tests/projects/asm/fasm/src/main.S @@ -0,0 +1,28 @@ +format MZ + +entry main:start ; program entry point +stack 100h ; stack size + +segment main ; main program segment + + start: + mov ax,text + mov ds,ax + + mov dx,hello + call extra:write_text + + mov ax,4C00h + int 21h + +segment text + + hello db 'Hello world!',24h + +segment extra + + write_text: + mov ah,9 + int 21h + retf + diff --git a/tests/projects/asm/fasm/xmake.lua b/tests/projects/asm/fasm/xmake.lua new file mode 100644 index 000000000..f728b2ca1 --- /dev/null +++ b/tests/projects/asm/fasm/xmake.lua @@ -0,0 +1,3 @@ +target("test") + set_kind("binary") + add_files("src/*.S") diff --git a/tests/projects/asm/gas/src/main.S b/tests/projects/asm/gas/src/main.S new file mode 100644 index 000000000..9c242f4a1 --- /dev/null +++ b/tests/projects/asm/gas/src/main.S @@ -0,0 +1,9 @@ + .global main + + .text +main: # This is called by C library's startup code + mov $message, %rdi # First integer (or pointer) parameter in %rdi + call puts # puts(message) + ret # Return to C library code +message: + .asciz "Hola, mundo" # asciz puts a 0 byte at the end diff --git a/tests/projects/asm/gas/xmake.lua b/tests/projects/asm/gas/xmake.lua new file mode 100644 index 000000000..f728b2ca1 --- /dev/null +++ b/tests/projects/asm/gas/xmake.lua @@ -0,0 +1,3 @@ +target("test") + set_kind("binary") + add_files("src/*.S") diff --git a/tests/projects/asm/nasm/src/main.S b/tests/projects/asm/nasm/src/main.S new file mode 100644 index 000000000..e96a8d2c9 --- /dev/null +++ b/tests/projects/asm/nasm/src/main.S @@ -0,0 +1,20 @@ +global _main + +section .text + +_main: + mov rax, 0x2000004 ; write + mov rdi, 1 ; stdout + mov rsi, msg + mov rdx, msg.len + syscall + + mov rax, 0x2000001 ; exit + mov rdi, 0 + syscall + + +section .data + +msg: db "hello xmake!", 10 +.len: equ $ - msg diff --git a/tests/projects/asm/nasm/xmake.lua b/tests/projects/asm/nasm/xmake.lua new file mode 100644 index 000000000..f728b2ca1 --- /dev/null +++ b/tests/projects/asm/nasm/xmake.lua @@ -0,0 +1,3 @@ +target("test") + set_kind("binary") + add_files("src/*.S") diff --git a/tests/projects/asm/yasm/src/main.S b/tests/projects/asm/yasm/src/main.S new file mode 100644 index 000000000..800722a44 --- /dev/null +++ b/tests/projects/asm/yasm/src/main.S @@ -0,0 +1,20 @@ +bits 64 + +extern _puts + +section .data + +message: + db 'hello xmake!', 0 + +section .text + +global _main +_main: + push rbp + mov rbp, rsp + lea rdi, [rel message] + call _puts + xor rax, rax + pop rbp + ret diff --git a/tests/projects/asm/yasm/xmake.lua b/tests/projects/asm/yasm/xmake.lua new file mode 100644 index 000000000..f728b2ca1 --- /dev/null +++ b/tests/projects/asm/yasm/xmake.lua @@ -0,0 +1,3 @@ +target("test") + set_kind("binary") + add_files("src/*.S") |
