diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-10-09 15:55:32 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-10-24 11:06:57 +0200 |
commit | 01ee14133906e4afa55cdc52eeb1c9e78bbeced5 (patch) | |
tree | c0efa434aa9e75479943d4fcd18bae0721eea67f /test cases | |
parent | 4e374d5cefd25dfa0de8debf0c53e8c6f74380d9 (diff) | |
download | meson-01ee14133906e4afa55cdc52eeb1c9e78bbeced5.zip meson-01ee14133906e4afa55cdc52eeb1c9e78bbeced5.tar.gz meson-01ee14133906e4afa55cdc52eeb1c9e78bbeced5.tar.bz2 |
Add NASM compiler
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/nasm/2 asm language/hello.asm | 21 | ||||
-rw-r--r-- | test cases/nasm/2 asm language/meson.build | 25 |
2 files changed, 46 insertions, 0 deletions
diff --git a/test cases/nasm/2 asm language/hello.asm b/test cases/nasm/2 asm language/hello.asm new file mode 100644 index 0000000..b153c8c --- /dev/null +++ b/test cases/nasm/2 asm language/hello.asm @@ -0,0 +1,21 @@ +%include "config.asm" + +global main +extern puts + +section .data + hi db 'Hello, World', 0 + +%ifdef FOO +%define RETVAL HELLO +%endif + +section .text +main: + push rbp + lea rdi, [rel hi] + call puts wrt ..plt + pop rbp + mov ebx,RETVAL + mov eax,1 + int 0x80 diff --git a/test cases/nasm/2 asm language/meson.build b/test cases/nasm/2 asm language/meson.build new file mode 100644 index 0000000..1fe0671 --- /dev/null +++ b/test cases/nasm/2 asm language/meson.build @@ -0,0 +1,25 @@ +project('test', 'c') + +nasm = find_program('nasm', required: false) +if not nasm.found() + assert(not add_languages('nasm', required: false)) + error('MESON_SKIP_TEST: nasm not available') +endif + +if not host_machine.cpu_family().startswith('x86') + assert(not add_languages('nasm', required: false)) + error('MESON_SKIP_TEST: nasm only supported for x86 and x86_64') +endif + +add_languages('nasm') + +config_file = configure_file( + output: 'config.asm', + configuration: {'HELLO': 0}, + output_format: 'nasm', +) + +exe = executable('hello', 'hello.asm', + nasm_args: '-DFOO', +) +test('hello', exe) |