Skip to content

[libc++] regression: new/delete symbol overrides broken on macOS #123224

Open
@tycho

Description

@tycho

This is referring to commit 8418955.

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.

Metadata

Metadata

Assignees

Labels

libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions