@@ -337,6 +337,30 @@ TARGETS += $(BUILD_LIBJVM)
337337# for the associated class. If the class doesn't provide a more specific
338338# declaration (either directly or by inheriting from a class that provides
339339# one) then the global definition will be used, triggering this check.
340+ #
341+
342+ # The HotSpot wrapper for <new> declares as deprecated all the allocation and
343+ # deallocation functions that use the global allocator. But that blocking
344+ # isn't a bullet-proof. Some of these functions are implicitly available in
345+ # every translation unit, without the need to include <new>. So even with that
346+ # wrapper we still need this link-time check. The implicitly declared
347+ # functions and their mangled names are - from C++17 6.7.4:
348+ #
349+ # void* operator new(size_t) // _Znwm
350+ # void* operator new(size_t, align_val_t) // _ZnwmSt11align_val_t
351+ #
352+ # void operator delete(void*) noexcept // _ZdlPv
353+ # void operator delete(void*, size_t) noexcept // _ZdlPvm
354+ # void operator delete(void*, align_val_t) noexcept // _ZdlPvSt11align_val_t
355+ # void operator delete(void*, size_t, align_val_t) noexcept // _ZdlPvmSt11align_val_t
356+ #
357+ # void* operator new[](size_t) // _Znam
358+ # void* operator new[](size_t, align_val_t) // _ZnamSt11align_val_t
359+ #
360+ # void operator delete[](void*) noexcept // _ZdaPv
361+ # void operator delete[](void*, size_t) noexcept // _ZdaPvm
362+ # void operator delete[](void*, align_val_t) noexcept // _ZdaPvSt11align_val_t
363+ # void operator delete[](void*, size_t, align_val_t) noexcept // _ZdaPvmSt11align_val_t
340364
341365ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
342366 ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
@@ -347,10 +371,18 @@ ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
347371 # so use mangled names when looking for symbols.
348372 # Save the demangling for when something is actually found.
349373 MANGLED_SYMS := \
350- _ZdaPv \
374+ _Znwm \
375+ _ZnwmSt11align_val_t \
351376 _ZdlPv \
377+ _ZdlPvm \
378+ _ZdlPvSt11align_val_t \
379+ _ZdlPvmSt11align_val_t \
352380 _Znam \
353- _Znwm \
381+ _ZnamSt11align_val_t \
382+ _ZdaPv \
383+ _ZdaPvm \
384+ _ZdaPvSt11align_val_t \
385+ _ZdaPvmSt11align_val_t \
354386 #
355387 UNDEF_PATTERN := ' U '
356388
0 commit comments