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

Define JNIEXPORT on Linux as __attribute__((externally_visible))

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Environment:

      gcc

    • Subcomponent:
    • CPU:
      generic
    • OS:
      linux

      Description

      This will enable GCC to compile JNI libraries with -fwhole-program.

      http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

      Of course is possible for the library developer to mark JNI functions as externally_visible themselves. However I can't think of a case where a library developer would want to declare a function as JNIEXPORT and not make it externally visible. If JNIEXPORT already tagged these functions as external then we'd be enabling optimization of JNI libraries with minimal effort for the library developer. Of course GCC's behavior would not change unless the linker was run with -fwhole-program.

      It might be necessary to wrap this setting of JNIEXPORT in #ifdef __GNUC__ in order to support other compilers.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              henryjen Henry Jen
              Reporter:
              dblaukop Daniel Blaukopf (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: