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

    <tr>
        <th>Summary</th>
        <td>
            [ARM] armv4/strongarm do not reject thumb
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    Related to #57486 and found when overviewing the code changes.

Similar to how ARMv2 and v3 reject thumb, v4 should reject thumb as well, but it silently accepts it.

```llvm
define void @dummy() {
  ret void
}
```
`clang -O2 --target=arm-none-eabi -march=armv4 -mthumb -fno-addrsig`
```asm
        .text
        .syntax unified
        .eabi_attribute 67, "2.09"
        .cpu    strongarm
        .eabi_attribute 6, 2
        .eabi_attribute 8, 1
        .eabi_attribute 9, 1
        .eabi_attribute 34, 0
        .eabi_attribute 17, 1
        .eabi_attribute 20, 1
        .eabi_attribute 21, 0
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 38, 1
        .eabi_attribute 14, 0
        .file   "test.ll"
        .globl  dummy
        .p2align        1
        .type   dummy,%function
        .code   16
        .thumb_func
dummy:
        .fnstart
        bx      lr
.Lfunc_end0:
        .size   dummy, .Lfunc_end0-dummy
        .cantunwind
        .fnend

        .section        ".note.GNU-stack","",%progbits
        .eabi_attribute 30, 1
```
Expected diagnostic:
```
error: unknown target triple 'thumbv4-none-unknown-eabi', please use -triple or -arch
```
When compiling this with GNU AS, this is emitted:
```
test.s: Assembler messages:
test.s:21: Error: selected processor does not support THUMB opcodes
test.s:25: Error: selected processor does not support `bx lr' in Thumb mode
```

------
This is also accepted by the assembler:
```asm
    .cpu strongarm @ or .arch armv4
    .code 16
```
Expected diagnostic
```
test.s:2:2: error: target does not support Thumb mode
        .code 16
        ^
```
Like before, GNU AS rejects this file.
</pre>
<img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