This change is unfortunately not correct for Linux and Solaris. We cannot link libfontmanager explicitly against either libawt_xawt or libawt_headless. See https://bugs.openjdk.java.net/browse/JDK-8196516 for my suggestion on a better fix than we currently have. I was hoping for Severin to check it out and pick it up, but he is away for a bit so that hasn't happened.

The reason we cannot link explicitly is that we need to decide at runtime whether to pull in the headful or headless libraries. If one or the other is already pulled in, and we explicitly load the other, the runtime linker will lookup the common symbols in one or the other in an unpredictable way. Some users get the correct behavior, some get the wrong behavior. We recently had discussions around this on this list if you want to dive deeper into it.

Also see https://bugs.openjdk.java.net/browse/JDK-8194870 for one of the consequences of explicit linking here.

I think the mac part is ok though, but Phil has to have a look. For Linux and Solaris, if you could remove the -lawt_headless and add "-Xlinker --unresolved-symbols=ignore-all" to LDFLAGS for linux I think we should be good.

/Erik

On 2018-03-14 04:45, Magnus Ihse Bursie wrote:
This is the final LDFLAGS cleanup, which required some more work to resolve.

Libfontmanager had previously explicitely disabled -z defs, with the result that linking did not complain about missing libraries. To fix this, I had to provide the proper libraries to link with. For linux and solaris, this was libawt_headless. For macosx, this was libawt_lwawt, but also three system frameworks.

Note that this patch has a merge conflict with JDK-8199606. The end result of both patches are shown in the patch (that is, with -lc removed). I will make sure to resolve the conflicts properly when committing this patch.

I have run COMPARE_BUILDS, with expected results. That is, no changes for Windows, and a deps change for macosx, linux and solaris. I also got a symbol change for linux, since the symbols from libawt_headless changed from e.g. "AWTCharAdvance" to "AWTCharAdvance@@SUNWprivate_1.1". And of course, when you do linking changes, you also end up getting binary/disasm changes.

Bug: https://bugs.openjdk.java.net/browse/JDK-8199608
WebRev: http://cr.openjdk.java.net/~ihse/JDK-8199608-clean-up-LDFLAGS-for-libfontmanager/webrev.01


Reply via email to