[11u] RFR: 8256557: libharfbuzz fails to link on gcc 4.4.x due to -Wl, -z, defs

Severin Gehwolf sgehwolf at redhat.com
Mon Nov 23 09:00:39 UTC 2020


On Fri, 2020-11-20 at 21:23 +0000, Hohensee, Paul wrote:
> Looks good!

Thanks for the review, Paul!

Cheers,
Severin

> Thanks,
> Paul
> 
> On 11/20/20, 12:49 PM, "Severin Gehwolf" <sgehwolf at redhat.com> wrote:
> 
>     Hi Paul,
> 
>     Thanks for the review!
> 
>     On Thu, 2020-11-19 at 00:48 +0000, Hohensee, Paul wrote:
>     > Set according to gcc version instead?
> 
>     OK. How about this?
> 
>     diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk
>     --- a/make/lib/Awt2dLibraries.gmk
>     +++ b/make/lib/Awt2dLibraries.gmk
>     @@ -547,6 +547,16 @@
>          HARFBUZZ_CFLAGS += -DHB_EXTERN=__declspec\(dllexport\)
>        endif
> 
>     +  LIBHARFBUZZ_LDFLAGS := $(LDFLAGS_JDKLIB) \
>     +                         $(call SET_SHARED_LIBRARY_ORIGIN)
>     +  ifeq ($(TOOLCHAIN_TYPE), gcc)
>     +    ifeq ($(CC_VERSION_NUMBER), 4.4.7)
>     +      LIBHARFBUZZ_LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
>     +        $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) \
>     +        $(call SET_SHARED_LIBRARY_ORIGIN)
>     +    endif
>     +  endif
>     +
>        ifneq ($(OPENJDK_TARGET_OS), windows)
>          HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
>                             -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
>     @@ -608,8 +618,7 @@
>                truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
>                hidevf w_novirtualdescr arrowrtn2 unknownpragma, \
>            DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138, \
>     -      LDFLAGS := $(LDFLAGS_JDKLIB) \
>     -          $(call SET_SHARED_LIBRARY_ORIGIN), \
>     +      LDFLAGS := $(LIBHARFBUZZ_LDFLAGS), \
>            LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
>            LDFLAGS_aix := -Wl$(COMMA)-berok, \
>            LIBS := $(BUILD_LIBHARFBUZZ), \
> 
> 
>     Thanks,
>     Severin
> 
> 
>     > On 11/18/20, 11:37 AM, "jdk-updates-dev on behalf of Severin Gehwolf" <jdk-updates-dev-retn at openjdk.java.net on behalf of sgehwolf at redhat.com> wrote:
>     >
>     >     Hi,
>     >
>     >     Please review this JDK 11.0.10 specific fix for building slowdebug on a
>     >     system with gcc 4.4.x (e.g. RHEL 6). JDK-8249821 got backported to
>     >     11.0.10 and that causes one slight difference in how libharfbuzz is
>     >     being linked: When it was linked as part of libfontmanager.so there was
>     >     no -Wl,-z,defs. After JDK-8249821 it's there, which makes the build
>     >     fail for slowdebug on this old toolchain. The proposal is to remove -
>     >     Wl,-z,defs from LDFLAGS_JDKLIB for libharfbuzz as was done before.
>     >
>     >     Bug: https://bugs.openjdk.java.net/browse/JDK-8256557
>     >
>     >     Patch:
>     >
>     >     diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk
>     >     --- a/make/lib/Awt2dLibraries.gmk
>     >     +++ b/make/lib/Awt2dLibraries.gmk
>     >     @@ -608,8 +608,9 @@
>     >                truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
>     >                hidevf w_novirtualdescr arrowrtn2 unknownpragma, \
>     >            DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138, \
>     >     -      LDFLAGS := $(LDFLAGS_JDKLIB) \
>     >     -          $(call SET_SHARED_LIBRARY_ORIGIN), \
>     >     +      LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
>     >     +        $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) \
>     >     +        $(call SET_SHARED_LIBRARY_ORIGIN), \
>     >            LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
>     >            LDFLAGS_aix := -Wl$(COMMA)-berok, \
>     >            LIBS := $(BUILD_LIBHARFBUZZ), \
>     >
>     >     Tested build on gcc 4.4.x slowdebug. Works with the patch.
>     >
>     >     I know this isn't pretty, but as there were no code changes done
>     >     in JDK-8249821 it would preserve the status quo. Plus, it would unbreak
>     >     our vanilla JDK 11 builds.
>     >
>     >     Thoughts?
>     >
>     >     Thanks,
>     >     Severin
>     >
>     >
> 
> 



More information about the jdk-updates-dev mailing list