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

    <tr>
        <th>Summary</th>
        <td>
            Non-determinism in bitcode writer for __asm__ ".symver"
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          pirama-arumuga-nainar
      </td>
    </tr>
</table>

<pre>
    This was observed when building AOSP's external/libfuse/lib/fuse.c with ThinLTO.  Here's a reproducer:

```
$ cat asm.c
__asm__("\t.symver " "fuse_loop_mt_32" "," "fuse_loop_mt@@FUSE_3.2");
int fuse_loop_mt_32()
{
 return 0;
}

__asm__("\t.symver " "fuse_loop_mt_31" "," "fuse_loop_mt@FUSE_3.0");
int fuse_loop_mt_31()
{
 return 0;
}

__asm__("\t.symver " "fuse_new_31" "," "fuse_new@@FUSE_3.1");
int fuse_new_31()
{
 return 0;
}

__asm__("\t.symver " "fuse_new_30" "," "fuse_new@FUSE_3.0");
int fuse_new_30()
{
 return 0;
}
$ for trial in {1..10}; do clang -c -flto=thin -o asm.o asm.c; mv ./asm.o ./asm_${trial}.o; done; sha256sum asm_*.o
7ee03d86cbd050146295325f1df1be2ee21ff5305d3d8f44b8c3084f7e032bd0 asm_10.o
3dd67c2162022d353a20395e4d0e58c652aacb35b31a4c6698ab022ea9595e1d asm_1.o
c74891863f6bc410f715bc2b9af7731cf70f5771eb904a8c6548dde5a3c88a19 asm_2.o
7ee03d86cbd050146295325f1df1be2ee21ff5305d3d8f44b8c3084f7e032bd0 asm_3.o
1923c4f6570916bab428bc6d7a132fc14d211259ad284a492b7710d88abb1ff3 asm_4.o
3dd67c2162022d353a20395e4d0e58c652aacb35b31a4c6698ab022ea9595e1d asm_5.o
3dd67c2162022d353a20395e4d0e58c652aacb35b31a4c6698ab022ea9595e1d asm_6.o
1923c4f6570916bab428bc6d7a132fc14d211259ad284a492b7710d88abb1ff3 asm_7.o
c74891863f6bc410f715bc2b9af7731cf70f5771eb904a8c6548dde5a3c88a19 asm_8.o
c74891863f6bc410f715bc2b9af7731cf70f5771eb904a8c6548dde5a3c88a19 asm_9.o
```

Converting the `.o` to LLVM IR using `llvm-dis` produces identical outputs though.  So does removing -flto=thin.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lluP4yYUxz8NeUGx4AAGP-RhMmnUStNu1Zn2NeLmmMo2EeCk--0rO0m7veyOVspKCbdz-PE_hBzQOYfj6P0GiS0Su5WeShfT5hSSHvRap2mYjno96jDqtDLRfdy8dSHji844muzT2Tt86fyIzRR6F8Yjfvrw-jMCmbH_o_g06h7Bvg-mnbK_thDs505l8SWUDr91YXx5-1Bh_L1PfpmpcfKnFN1kfULsCZEdIveyJrfPtQscW12wzkNlr0OHg87D4YBAIQAknkuVPw5nnzACmL_z2oc-xtNhKAcGt1EEz_9jR5wgTva_vn53YBUsbg1i2-tCYSz4PzA1e1ylyZsfTr5MacTkr5lI7j6N6esU0_cU3-SSd-XSbyh39JfPSh395R8bSz-n9A75tirJl1S-t5l3wldKBI7bmHBJQfc4jBjJLa0qSmYPtsUuYtvr8YjXFq_bvkTEdqULI17H5ajH24FnWzyccYVgfx29tQ4IOJLbhY7kropX5ujnOncaRJ2nAV89n6p4FSW9J8yp2hpHBKG8hkYwEC11LTUevAfatoIR4ZhTLedGWUYUb6UnDIwjC4-SO445V0sLtAYC4JhgGghrhOeOeKFsLUBra5gwjGpu67pR2hAArxvRCE_dFXenWclVQ1XN2tpYTkkrqTAWTKNbKRm1rSStkJJ60xCuZzxXznmhmVVK02ahwUNDZXcabYBZ3tZCkobWRhsOytjaSU0ZtJZyB5SCaLQDxTVvwEhJiVNKG0Pbli00_tB9Ew-l1Q-NVD70N1UPpTV32r_vmaV8juPZpzLfcqXzGNXzYa8JLhG_vPz2I_7hFzzl2Ypq0vfnYe1Cnu23uyzj4Px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