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

    <tr>
        <th>Summary</th>
        <td>
            llvm-ml: Cannot properly generate instructions with labels and variables
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          Zero-Tang
      </td>
    </tr>
</table>

<pre>
    When I try to load a register with a label or a register, the llvm-ml seems to generate an instruction loading an immediate number to the register.
Example code:
```Assembly
extern example_variable:qword

example_code proc

mov rcx,qword ptr [example_variable]
mov r8,example_label
example_label:
ret

example_code endp
```
When I inspect the binary code, I noticed that these `mov` instructions are writing immediate numbers into the registers. IDA would mark these immediate numbers with red background. I tried both LLVM 13.0.0 and 13.0.1. Both versions suffer from this bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1Uslu2zAQ_RrpMrCg1ctBByduAQPprWiBXgpSHMtsuKgkZcd_3xFlI46DAoREzvLezLzhVlzan0c0sIfgLhAsKMsEMHDYSx_QwVmGI70V46jAujtXUj5DOCIoddILrcAjaj9B9GjQsYDADEjjgxu7IK2J0NL00aw1CjnFmFFzoqG0CeuGnSX5Lsm3X96YHhRCZwUm1XY2Jst8PlvvUXN1mc34RnkGcE75fWJOMq6mtL9n68Q19xo6x0ywMDjb3Tu1PYHr3qi7mAdDcJA0T59wm91d_JrCbxFxVB-JZtOtAYfhv9WgEcNDm_PzqhLNc8AuxGFxaRiJFodDWuzB2CA7FORkMcIjUD4VSN97JTwwh3B2MkxyPGrhKfRBDp_BfreFsx2VAM3c6xX9c2pcF0c1cNa99s6ORmRxueRks-R8efnxDYoqy7OcNkHM1yKDp8l5IoxYoB8PB1qLg7OauKQHPvZZKtpKbKoNS4MMCtvr5tFg4ZkZ6n4Sc0CnLu87-KHtWF0Uw0fum5g-HZ1qjyEMflKp_Eqnp9iRZ53V9JiYrr8FcfwhCegpvR_R06Wpi6pJj-2yKhnrDsuuoAvnTVGv6qoUh1VerQVf5enM3dI-JWVp8AwRgu60Tqlsy7ws8yovik2xrstss-Js2XCRr1f1EplI6hw1kyqb6sis61M3z4CG48mpSCz_7mTey94gRjrCZ2M4Wtf-QmcX35np00jexuL_AdXDWgQ">