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

    <tr>
        <th>Summary</th>
        <td>
            Dollar sign in section name is handled incorrectly for intel-style inline assembly for Windows target
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          Evian-Zhang
      </td>
    </tr>
</table>

<pre>
    This was first found in Rust, see [rust-lang/rust#128177](https://github.com/rust-lang/rust/issues/128177).

The issue exists in the following inline assembly, for both Rust and Clang:

```x86asm
.pushsection .foo$a
.long 0x1234
.popsection
```

For x86-64 Windows target, when we compile with AT&T syntax, the result section name is ".foo", for intel syntax, the result is ".fooa".

As described in [this Microsoft blog](https://devblogs.microsoft.com/oldnewthing/20181107-00/?p=100155), the part before dollar sign should be the final name, and the part after should be used to sort the corresponding section. And this feature is extremely useful to create pointers to specific sections, as stated in [this](https://stackoverflow.com/a/14783759/10005095) and used in [this](https://docs.rs/linkme-impl/0.3.27/src/linkme_impl/linker.rs.html#55).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE2PozgQ_TXmUgoyBkI4cEhPNre9rFpaaS8rYwrwjrGRy3SSf7-yk0x3z7RGikJCvXp-fvUhifRkETtWv7D6lMktzM53f7xpaXf_zNJOWe-GW_c6a4KLJBi1pwCj2-wA2sJfGwUmvgEhAqtf_EZhZ6SdmDj7FCoLcSiahtUnJg5zCCux8sjEmYnzpMO89blyywP9OfOsiTYkJs4PCtHmjJ8YP96_X2eEBAG8agoU5YQZYXTGuIu2E2hrtEWQRLj05hZ1js5D78KchIO0A3xLh5bHj9Rsz--f62Evabm_zNeNZkIVtLOQj84xUclHyDg7Ab8WoqyeYLc-sD9Rfjzn7DxcD_vdvoK_tR3chSBIP2Gy9DKjhQuCcsuqDcJFhxmOr0zsX4FuNshrRMUbe6TNBHhqs3KJzgAT4i5TPG-ubUDzdfI7XsbnR5VHggFJed1jqjmrX0Jshz-18o7cGKA3bvqqwgO-xRDlyxP6qLYzg8VLmHWqt-DFoSh4s-M85pXnlZWngvOirplon0JX6QP0ODqPMDhjpIfYu0Cz28wAPd6rr600yYKYFwv8I1eOAf0H-EY4QHBAzoeEUs57pNXZIXbPw84cjolEE4wow-aTt3gNHhc0t8gybibyKI8yIKwu2uwpUa-o9KjVk4ySKAIKMnwy8yv3KEj13b2hH427PIyTcRyq5lA2dRt_cs5r3kab0l3TlX7POjhFuY9jZbT9vuBOL6th4szzMhdNPNarH8F_H8H4D33uKZ_DYpgoU2XybOjKoS1bmWFXNELsK9E2RTZ3vRr2VdGOJXIlKt4WqlSVOgwDbyqlqjLTneCi4gcuRFnviyKXshRNq-qyrBpUZcUqjovUJjfmbcmdn7I0613Bi6bZZ0b2aChtLSEsXu6bILZ6fcp8F5N2_TYRq7iJy-GdJuhgsDt9aCBtfxmdWdrBJCtTT6hgbu8DtKNwM_jzdknxz1Ocbd50v9l5UdPjsVu9-w_V57V3v-pbJ_4PAAD__1SS0cY">