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

    <tr>
        <th>Summary</th>
        <td>
            Mangled names for internal linkage functions in `extern "C"` are different from GCC
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:codegen
      </td>
    </tr>

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

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

<pre>
    This records a name mangling difference with GCC. It's possible that Clang's decision is desired and we should not take any action.
(I saw a relevant issue about this but I cannot find it now.)

```cpp
extern "C" {
static void f0() {}
static void f0(int) {}
}
```

* GCC: error: conflicting declaration of C function ‘void f0(int)’
* Clang: accepted; names are mangled

C++  https://eel.is/c++draft/dcl.link gives an example:
```
extern "C" {
  static void f4();             // the name of the function f4 has internal linkage,
                                // so f4 has no language linkage; its type has C language linkage
}
```

If `f4` has no language linkage, it seems to make sense to mangle it. So Clang's choice is probably desired.

GCC's decision allows alias/ifunc attributes with an unmangled name: `void g4() __attribute__((alias("f4")))`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVM2SozYQfhpx6VoKBGPDgYPNxKk57CXJfaqRGlBGSJQkxuu3TwnsGXs3kwpF2UI_3a3vp9F7NRiihj0d2dNzgksYrWu-o3_7Ay9JZ-Wl-WtUHhwJ66QHBIMTwYRm0MoMIFXfkyMjCM4qjPB726bwEhjfe5it96rTBGHEAK1GM6zzkoTyyhpQceyVIwloJJwJ_GgXLcHYAAHfCNBcAEVQ1qQse2bZgfHqBTyeAcGRpnc0AZT3CwF2dgkQYrHdEuAFBJoYp1dGggpg7DllvL6G2X532faKed5m6EcgZ4Bx3jLOge2P27wPGJSAd6sk9BnjFeP1urp__mKDMuHnPZ-DW96HYvghoseKA5Bz1sWBsKbXSoQVaRIaHUYswPbQQr-YFRlgv3FWZayufs5-W6g_M2wsFAdAIWgOJFlxXCn1gO7KK8n7ulrGj4wfAcYQZs-KA-Mnxk9EOlWe8ZPY1qXDPjB-kkKnWpk3GNR7DGqAfuA0a4on_-32X0EO8IBpuYEey71_tmIgjLQJ0_br-AObvoQRPSgTk6CGWBoOxHh7y_LfzzW-t7dIxkKEcMGBPoIVR1DBQ7jMtO5pf93yPwTw0gPbZX3JdtmXmXgbpeyJJg_BwhQ94sl42r4ieaBCCn_aO7-J0SpB0W2zsx12-nKzXXqfP4rvwZ6otT17QK0wEq0iqIAhONUtgfxmeDSwmKtsVgqiuNguW1kbrqzB6-vHudfXda66hq0Y55FcHsnd3l2WJrIpZF3UmFCT73Ne78q8KJKxEft91vVY5YRyV5RdznOJHce-QlnvuyxRDc94mZU55wXneZHuipJnvRR5tc-rrixZmdGESqdav0-pdUOy9o-mqp7qItHYkfZrO-RcXM0irKSBTCzy6TlxTTz5rVsGz8pMKx_8Z6yggqbm-x0eHnrrfhHgh0KjNiNejzaIGoh-vLXXAL2zU-wPyeJ082jFQYVx6VJhJ8ZPsZLr37fZ2b9JRFeuV4wkrrf8JwAA___B2s_M">