<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60387>60387</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            How to pass -asm-macro-max-nesting-depth to assembler?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Gei0r
      </td>
    </tr>
</table>

<pre>
    I want to compile an assembler source that uses recursion to build a loop.
This hits the assembler's recursion limit with the following error message:

```
error: macros cannot be nested more than 20 levels deep. Use -asm-macro-max-nesting-depth to increase this limit.
```

**How can I pass `-asm-macro-max-nesting-depth=40` to the assembler?**

This doesn't work (argument unused during compilation and doesn't get passed to assembler):

```
clang -v -asm-macro-max-nesting-depth=40 test.S -o test.o


Alpine clang version 15.0.7
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin
clang-15: warning: argument unused during compilation: '-asm-macro-max-nesting-depth=40' [-Wunused-command-line-argument]
 "/usr/bin/clang-15" -cc1 -triple x86_64-alpine-linux-musl -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.S -mrelocation-model pic -pic-level 2 -pic-i
s-pie -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/build -resource-dir
/usr/lib/clang/15.0.7 -internal-isystem /usr/local/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /usr/lib/clang/15.0.7/include -fdebug-compilation-dir=/build
 -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-5d6960.s -x assembler-with-cpp test.S
clang -cc1 version 15.0.7 based upon LLVM 15.0.7 default target x86_64-alpine-linux-musl
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
 /usr/lib/clang/15.0.7/include
End of search list.
 "/usr/bin/clang-15" -cc1as -triple x86_64-alpine-linux-musl -filetype obj -main-file-name test.S -target-cpu x86-64 -fdebug-compilation-dir=/build -dwarf-debug-producer "Alpine clang version 15.0.7" -dwarf-vers
ion=5 -mrelocation-model pic --mrelax-relocations -o /tmp/test-4d6df5.o /tmp/test-5d6960.s
<instantiation>:2:9: error: macros cannot be nested more than 20 levels deep. Use -asm-macro-max-nesting-depth to increase this limit.
```

I tried using `-Wa`, but it doesn't work either:

```
clang -v -Wa,-asm-macro-max-nesting-depth=40 test.S -o test.o

Alpine clang version 15.0.7
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin
clang-15: error: unsupported argument '-asm-macro-max-nesting-depth=40' to option '-Wa,'
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMV01v67YS_TXyZjCCTPkjXnjhxnEboN28vte7DChyJLOXIgWSinP__cNQ9o2Te_MBdFPAUCRyZjicc3g4kTGazhFti-UvxXI_k2M6-rD9lUwVZo3X37b3cJIuQfKgfD8YSyAdyBipbywFiH4MiiAdZYIxUoRAagzReMcuzWisBgnW-6Esqn1R7f57NBGOJkVIR3oOVIj1ta81vUlwMumYzVpvrT8Z1wGF4AP0FKPsqKh3U9Dzc1Wdf_kzmxb1Dnqpgo-gpHM-QUPgKCbS0PuQM3cgKrD0SDaCJhpK-F8kQBl7zK7YyydkH-M61DRwUh6MU4Fk5AgmTgmXP83j_BT8-82fOA-4h0HGCMWqem-Zot4vOA4v97Ja9WGKd71Crqz2FF0h1glOPnyFQtzI0I09uQSjGyNp0GPgQk5oysTVlk5fOXaUcnaked0rhDbv11tZ6TrAx3crl7cEiWIq_wT005t_ETU_d3YwjmCK-UgTK-bLsirX593K0FFieJ9uVg-rBcrsgda48Qn7MdpLVQJJxlqTZevBR_M0Td27mK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