RFR: JDK-8196218: [linux] libfontmanager should be linked against headless awt library

Severin Gehwolf sgehwolf at redhat.com
Fri Jan 26 16:53:31 UTC 2018


Hi Erik,

Thanks for the feedback!

On Fri, 2018-01-26 at 08:27 -0800, Erik Joelsson wrote:
> Hello Severin,
> 
> If adding the -lawt_headless makes the code compile with -Wl,-z,defs, 
> then I would also like to see that filtering removed in the same patch.

Agreed.

> However, I think someone from 2d needs to shed some light on the origin 
> of this. I would assume that at some point there was a reason for not 
> adding -lawt_headless to libfontmanager, and for that to work, someone 
> removed the -Wl,-z,defs from that linker command line. Tracing this 
> back, the removal of -z defs was there in the initial Mercurial commit, 
> so someone needs to go back into the really old archives to find answers 
> here.

Interested to hear the answer to this. If that's still possible, that
is.

> Regarding -Xlinker vs -Wl, I believe we tried to unify usage to one or 
> the other at some point.

Fair enough. It's still sub-optimal that it might fail for one variant
but not the other. If it's filtering, it should do it for both
variants. W discovered this in the first place because the flags that
get set are -Wl,-z,defs yet the JDK 8 filter is for -Xlinker. Now with
JDK 11 it's the other way around.

With that being said, this discussion is a moot point if we can remove
this.

Thanks,
Severin

> /Erik
> 
> On 2018-01-26 08:10, Severin Gehwolf wrote:
> > Hi,
> > 
> > Could I please get a review for this rather small patch which
> > originally occurred for us on JDK 8 (Fedora) which recently switched to
> > building with "-Wl,-z,defs" linker flags. The result was a build
> > failure, due to unresolved symbols. Indeed libfontmanager.so should
> > have -lawt_headless in the list of dependent libs as symbols such as
> > AWTLoadFont come from libawt_headless.so, not libawt.so on Linux. Some
> > more details are on the bug.
> > 
> > webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8196218/webrev.01/
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8196218
> > 
> > Testing: Build fails with configure option
> >           --with-extra-ldflags="-Xlinker -z -Xlinker defs"
> >           prior the fix. Succeeds after.
> > 
> > Question for 2d-folks/build-dev folks:
> > 
> > There is this snippet in the libfontmanager block in
> > make/lib/Awt2dLibraries.gmk, line 686:
> > 
> >      LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
> >          $(call SET_SHARED_LIBRARY_ORIGIN), \
> > 
> > It's my understanding that this is supposed to filter "-Wl,-z,defs"
> > from LDFLAGS_JDKLIB. Does anybody know why it does so? Is there a legit
> > reason when unresolved symbols at link time are OK? Besides, why does
> > it not also filter "-Xlinker -z -Xlinker defs"? FWIW, in JDK 8 it's the
> > other way round. Xlinker flags are filtered, but -Wl,-z,defs is not.
> > Thoughts?
> > 
> > Thanks,
> > Severin
> 
> 


More information about the build-dev mailing list