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

    <tr>
        <th>Summary</th>
        <td>
            [libc++] regression: new/delete symbol overrides broken on macOS
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

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

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

<pre>
    This is referring to commit https://github.com/llvm/llvm-project/commit/841895543edcf98bd16027c6b85fe7c6419a4566.

In a shared library which statically links libc++ (ANGLE's libEGL in this case), the symbols for `new` and `new[]` are, as of the above commit, suddenly exposed as global, but the corresponding `delete` and `delete[]` operators are not.

Before the above commit:
```
$ nm -g -C --defined-only contrib/angle/angle/out/macOS-Debug-arm64/libEGL.dylib | grep -e new -e delete
```

After:
```
$ nm -g -C --defined-only contrib/angle/angle/out/macOS-Debug-arm64/libEGL.dylib | grep -e new -e delete
00000000001e9460 T operator new[](unsigned long)
00000000001e9740 T operator new[](unsigned long, std::align_val_t)
00000000001e9328 T operator new(unsigned long)
00000000001e95e0 T operator new(unsigned long, std::align_val_t)
```

This causes applications like mine with custom allocators (mimalloc in this case) to provide the implementations for the operator `new` symbols, but not the `delete` symbols, which inevitably causes a crash within the shared library when it tries to free memory.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVctu6zYQ_Rp6M7BBUU8vtFCc64sCF-2i2V_wMZLYUKRAUk799wVl5VGnQJtdDQOEh5rRmTNzjnkIerCILSkfSPm440scnW_jVY5uJ5y6tk-jDqADeOzRe20HiA6kmyYdYYxxDiTvCDsTdh50HBdxkG4i7GzM5fXYz979gTISdr7lEXZuiqw5lmWRo5L9sREqqyirZSWassdaVkV25EVZVQdCO0K7XyxwCCP3qMBo4bm_wsuo5Qgh8qglN-YKRtvnkK4lYQ-EPQBhTffr9x_fCKvX-LfvP0Bbi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