Skip to content

Commit af9658a

Browse files
qookeieli-schwartz
authored andcommitted
nasm: Use different test sources for x86 and x86_64
The x86 test files might not work on x86_64 Linux in certain cases, for example if the kernel is configured without support for x86 executables (which also gets rid of the old system call interface). Bug: https://bugs.gentoo.org/936911 (cherry picked from commit 9501228)
1 parent e409a55 commit af9658a

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
%include "config.asm"
2+
3+
section .data
4+
msg: db "Hello World", 10
5+
len: equ $ - msg
6+
7+
section .text
8+
global main
9+
main:
10+
mov eax, 1 ; sys_write
11+
mov edi, 1 ; fd = STDOUT_FILENO
12+
mov rsi, msg ; buf = msg
13+
mov rdx, len ; count = len
14+
syscall
15+
16+
mov eax, 60 ; sys_exit
17+
mov edi, HELLO ; exit code
18+
syscall

test cases/nasm/1 configure file/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ config_file = configure_file(
5050
cc = meson.get_compiler('c')
5151
link_args = cc.get_supported_link_arguments(['-no-pie'])
5252

53-
exe = executable('hello', asm_gen.process('hello.asm'),
53+
exe = executable('hello', asm_gen.process('hello-' + host_machine.cpu_family() + '.asm'),
5454
link_args: link_args,
5555
)
5656

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
%include "config.asm"
2+
3+
%ifdef FOO
4+
%define RETVAL HELLO
5+
%endif
6+
7+
section .data
8+
msg: db "Hello World", 10
9+
len: equ $ - msg
10+
11+
section .text
12+
global main
13+
main:
14+
mov eax, 1 ; sys_write
15+
mov edi, 1 ; fd = STDOUT_FILENO
16+
mov rsi, msg ; buf = msg
17+
mov rdx, len ; count = len
18+
syscall
19+
20+
mov eax, 60 ; sys_exit
21+
mov edi, RETVAL ; exit code
22+
syscall

test cases/nasm/2 asm language/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ config_file = configure_file(
4646
cc = meson.get_compiler('c')
4747
link_args = cc.get_supported_link_arguments(['-no-pie'])
4848

49-
exe = executable('hello', 'hello.asm',
49+
exe = executable('hello', 'hello-' + host_machine.cpu_family() + '.asm',
5050
nasm_args: '-DFOO',
5151
link_args: link_args,
5252
)
@@ -55,7 +55,7 @@ test('hello', exe)
5555
#Test whether pthread dependency gets filtered out
5656
threads = dependency('threads')
5757

58-
exe2 = executable('hello_w_threads', 'hello.asm',
58+
exe2 = executable('hello_w_threads', 'hello-' + host_machine.cpu_family() + '.asm',
5959
config_file,
6060
nasm_args: '-DFOO',
6161
link_args: link_args,

0 commit comments

Comments
 (0)