aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-09 15:55:32 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-10-24 11:06:57 +0200
commit01ee14133906e4afa55cdc52eeb1c9e78bbeced5 (patch)
treec0efa434aa9e75479943d4fcd18bae0721eea67f /test cases
parent4e374d5cefd25dfa0de8debf0c53e8c6f74380d9 (diff)
downloadmeson-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.asm21
-rw-r--r--test cases/nasm/2 asm language/meson.build25
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)