On Mon, 27 Mar 2023 05:23:26 GMT, David Holmes <dhol...@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"))) > > ? @dholmes-ora Do you mean something like this (instead of removing the `-D` expression)? STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \ -DJNIEXPORT='__attribute__((visibility("default")))'" I can surely do that if that's preferred. No preference either way as far as I'm concerned. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13177#discussion_r1149000471