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

    <tr>
        <th>Summary</th>
        <td>
            The compiler generates mangled weak symbol in `extern "C"`
        </td>
    </tr>

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

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

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

<pre>
    example:
```c++
// weak.cpp
extern "C" {
int __xxx(void) { return 0; }
#pragma weak xxx = __xxx
}
```

```bash
$ clang++ -shared weak.cpp -o libweak.so
$ nm -D libweak.so
                 w __cxa_finalize
 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000001100 T __xxx
0000000000001100 W _Z3xxxv
```

compare with gcc:

```bash
$ g++ -shared weak.cpp -o libweak_gcc.so
$ nm -D libweak_gcc.so
                 w __cxa_finalize 
                 w __gmon_start__ 
                 w _ITM_deregisterTMCloneTable 
                 w _ITM_registerTMCloneTable 
00000000000010f9 T __xxx 
00000000000010f9 W xxx
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE9vuzgQ_TTmMkpkBkrMgUPbKNIeeotUqRdkzADeNQbZTkL306_In6bZKunPsoQ8773BfjMa6b1uLVHBnl7Y0zqSu9ANrng2RtqPT0tRNdSfBU2yHw2x5JnxNePPLOOnrRi-zPsUxQ3DDRxI_rNU43gK0hTIWWCIrwwR2OpM1jZAWU7TxFDsB10zzGcQHIWds8BZ8gJstb5kTkYn214ek8M0TcCS9Vl_YnxRL1c7H2-DlfTdJWUKykjbnl4AC99JR_XX7WExgNHV8eiHq8b2sFj_QOD_6wBlqSZZNtpKo_-lM20Ot_1gSx-kC2V5X_3X9q2syVGrfSC3fXs1g6WtrAw91txX8G8rjjmH7XcDf6DvUH4k0zTtH_iqhn6UjuCgQwetUtcGeWT7H1hetkrdt_0G_dV6eMD7XosHvPvF-EX0QHJjOG_ySznuwe9wbfaLr1FdJHWe5DKiIl7FIsuzFEXUFXVKeZZXshIoqW5EnhDVhJlseJMgVpEukGPKs1jwVcpRLIWqcyF4IzBuRKwylnLqpTZLY_b9cnBtpL3fUZE_iTyOjKzI-OPQQLR0gCPIEOcZ4opZs6h2rWcpN9oHf80SdDBUbDuCuXm0IQctWXIykIde2tacOwL8Z18NBrQFlvHbMTI_fedM0YUw-rnpjpOn1aHbVUs19Aw38w_Pn8Xohr9JBYab4zU9w83pGfsC_wsAAP__c5trSA">