Repository: mesonbuild/meson

Issue:
Meson injects unsupported Nasm flags with Yasm
**Describe the bug**

Yasm does not support optimization flags when called, which breaks using the Nasm language with it.

**To Reproduce**

meson.build: 

```
project('test', 'c')

add_languages('nasm', required: true)

config_file = configure_file(
  output: 'config.asm',
  configuration: {'HELLO': 0},
  output_format: 'nasm',
)

cc = meson.get_compiler('c')
link_args = cc.get_supported_link_arguments(['-no-pie'])

exe2 = executable('hello_w_threads', 'hello.asm',
  config_file,
  nasm_args: '-DFOO',
  link_args: link_args,
  dependencies: [threads]
)

test('hello_w_threads', exe2)
```

hello.asm:

```
%include "config.asm"

%ifdef FOO
%define RETVAL HELLO
%endif

    SECTION .data        ; data section
msg:    db "Hello World",10    ; the string to print, 10=cr
len:    equ $-msg        ; "$" means "here"
                ; len is a value, not an address

    SECTION .text        ; code section
        global main        ; make label available to linker
main:                ; standard  gcc  entry point

    mov    edx,len        ; arg3, length of string to print
    mov    ecx,msg        ; arg2, pointer to string
    mov    ebx,1        ; arg1, where to write, screen
    mov    eax,4        ; write sysout command to int 80 hex
    int    0x80        ; interrupt 80 hex, call kernel

    mov    ebx,RETVAL    ; exit code, 0=normal
    mov    eax,1        ; exit command to kernel
    int    0x80        ; interrupt 80 hex, call kernel
```

**Expected behavior**

Build to succeed. Instead, I get (in my work project):

```
/usr/bin/meson --internal yasm yasm -Ilibvpx-sse2.a.p -f elf64 -DELF -D__x86_64__ -Ox -g dwarf2 -I.. -I. -Ilibvpx-sse2.a.p --depfile libvpx-sse2.a.p/vpx_dsp_x86_sad4d_sse2.asm.o.d -o libvpx-sse2.a.p/vpx_dsp_x86_sad4d_sse2.asm.o ../vpx_dsp/x86/sad4d_sse2.asm
yasm: warning: unrecognized option `-Ox'
```

**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? **Native**
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) **Debian bookworm**
* what Python version are you using e.g. 3.8.0 **3.11.2**
* what `meson --version` **1.0.1**
* what `ninja --version` if it's a Ninja build **1.11.1**



Discussion:
@amyspark can you make a PR please? It should simply override get_optimization_args() in YasmCompiler class.

Resolving patch:
diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py
--- a/mesonbuild/compilers/asm.py
+++ b/mesonbuild/compilers/asm.py
@@ -149,6 +149,10 @@ def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]:
 class YasmCompiler(NasmCompiler):
     id = 'yasm'
 
+    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
+        # Yasm is incompatible with Nasm optimization flags.
+        return []
+
     def get_exelist(self, ccache: bool = True) -> T.List[str]:
         # Wrap yasm executable with an internal script that will write depfile.
         exelist = super().get_exelist(ccache)


Test patch: