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

    <tr>
        <th>Summary</th>
        <td>
            IAS "expected assembly-time absolute expression" vs jmp relaxations
        </td>
    </tr>

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

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

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

<pre>
    Full example: https://godbolt.org/z/hEG9nx39b

A number of recent CVE mitigations need an instruction in the middle of a function aligned on a boundary.  The following is a simplified form of the construct used to keep this working more nicely than hardcoding everything:

```asm
.align 64
.skip 64 - (aligned_boundary - some_func), 0xcc

some_func:
 nop

    je 1f
    //.byte 0x74, 1f - (. + 1)
    //je.d8 1f
 
    nop
aligned_boundary:
    nop
1:
 ret
```

GAS compiles this just fine, but Clang IAS fails with
```
<source>:2:7: error: expected assembly-time absolute expression
.skip 64 - (aligned_boundary - some_func), 0xcc
 ^
```

It turns out this is caused by the `je 1f` in the middle. Swapping it for an opencoded form using `.byte` makes Clang happy again.

Presumably this is because Clang tries to evaluate the `.skip` expression before it knows whether `je` is going to be the disp8 or disp32 form.  However, even when using `je.d8` to force the disp8 form, it still fails.

I understand that if the offset is genuinely variable, the result can't be assembled, but these examples do not have variable size.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVU1v4zgM_TXKhajhyK6THHzIdJrZ3hboYq8D2aJjNbJkiFQ-5tcvZCeTTLFYYDFA0dim-Pge9SgpIrN3iLV4_iKevy5U5N6HWjl96ftx0Xh9qXfRWsCzGkaLothCzzySKLZC7oTc7b1uvOXMh72Qux9C7vrXbxt3LjaNyL-KfDv_34KLQ4MBfAcBW3QML3-_wmDY7BUb7wgcogblwDjiENv0EYwD7hEGo7XFlKugi26OKZuoa0iP0PjotAqXDOCvHqHz1vqTcXswBArIDKM1nUENnQ9DAk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