Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369188

Update link-time check for HotSpot uses of allocation and deallocation functions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 26
    • infrastructure
    • None

      In CompileJvm.gmk we have code to perform a link-time check for references to global allocation and deallocation functions by HotSpot code. This code uses the variable MANGLED_SYMS to determine what names must not be referenced.
      https://github.com/openjdk/jdk/blame/2c114d676d9904094dd6058d15f06d801ec7a3d6/make/hotspot/lib/CompileJvm.gmk#L345-L350

      The list of names was incomplete after the update to use C++14, and even more so after the update to use C++17.

      But after JDK-8369187 we might not need a complete list of all the global allocation and deallocation functions declared by <new>. Instead, it is probably sufficient to only include the names of the functions that are implicitly declared in every translation unit. (We need those because they can be referenced without including our wrapper for <new> that declares all of the allocation and deallocation functions therein to be deprecated, and so unusable by HotSpot code.)

      That list is in C++17 6.7.4, and consists of the following (along with the associated g++/clang mangled names)

      {noformat}
      void* operator new(size_t) // _Znwm
      void* operator new(size_t, align_val_t) // _ZnwmSt11align_val_t

      void operator delete(void*) noexcept // _ZdlPv
      void operator delete(void*, size_t) noexcept // _ZdlPvm
      void operator delete(void*, align_val_t) noexcept // _ZdlPvSt11align_val_t
      void operator delete(void*, size_t, align_val_t) noexcept // _ZdlPvmSt11align_val_t

      void* operator new[](size_t) // _Znam
      void* operator new[](size_t, align_val_t) // _ZnamSt11align_val_t

      void operator delete[](void*) noexcept // _ZdaPv
      void operator delete[](void*, size_t) noexcept // _ZdaPvm
      void operator delete[](void*, align_val_t) noexcept // _ZdaPvSt11align_val_t
      void operator delete[](void*, size_t, align_val_t) noexcept // _ZdaPvmSt11align_val_t
      {noformat}

            Unassigned Unassigned
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: