RFR: 8304871: Use default visibility for static library builds

David Holmes dholmes at openjdk.org
Mon Mar 27 05:26:31 UTC 2023


On Fri, 24 Mar 2023 15:31:32 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> Please review this change for symbol visibility of static library artefacts. This fixes an issue when
> OpenJDK is being used as a base for generating native images preventing the symbols from being
> exported and looked up from the executable. Note that symbol visibity is now controlled by a
> linker version script downstream. This changes nothing for the regularly shipped dynamic libraries.
> 
> Thoughts?

make/autoconf/flags-cflags.m4 line 639:

> 637:   STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
> 638:   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
> 639:     STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections"

Is it better/clearer to make the use of the default explicit as we do in the source:

#define JNIEXPORT     __attribute__((visibility("default")))

?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13177#discussion_r1148797430



More information about the build-dev mailing list