RFR: 8166189: Fix for Bug 8165524 breaks AIX build

Thomas Stüfe thomas.stuefe at gmail.com
Thu Sep 22 07:05:00 UTC 2016

Hi Kumar,

> On 9/16/2016 10:34 AM, Volker Simonis wrote:
>> Hi Christoph,
>> I think your change is fine as a quick-fix to fix the build. But
>> you're completely right that this should be reworked in the long term.
>> I hate to see that we now have the third version of these routines in
>> the OpenJDK. Unfortunately a clean solution is not trivial.
>> libjli is not linked against libjvm because libjli is actually used to
>> load libjvm. So we can not put the dladdr routines for AIX there. But
>> I think we should at least consolidate the two versions which will be
>> in the class library after your change. Initially I intentionally put
>> porting_aix.{c,h} into jdk/aix/porting with the intent to make it
>> available to ALL jdk native libraries.
>> Unfortunately, with the source code reorganization due to the modular
>> changes, the common, top-level aix repository had to go away and the
>> code was moved to src/java.desktop/aix/native/libawt/porting_aix.c.
>> With the reorganized, modularized source code layout and build system
>> it is not possible to share code between modules. We somehow have to
>> fix this although I currently don't know how. IF somebody has an idea,
>> please let me know :)
> Why doesn't AIX support a Standard C API that most other
> *nix based OS'es support ?
dladdr() is not Posix, hence it should not be used in code that wants to be
portable across Unix systems. Afaik dladdr() is a propietary Solaris API
that was adapted by the glibc and slowly spread over to some other Unices,
but by no means all of them.

dladdr makes a number of assumptions about the architecture: e.g. that a C
function pointer points into the text segment of the binary instead of e.g.
a PLT, or that a loaded binary is placed continuously in memory (we only
have one dli_fbase in DL_info). So imho  it makes sense to not make this a
standard Posix API.

We (SAP) implemented dladdr atop of loadquery(), and this kind of works,
although we had to add some hacks to handle both real code addresses and C
function pointers. So the code is there, it is "just" a question of where
to place it.

Kind Regards, Thomas

> Kumar
>> Regarding your change:
>> - can you please move
>> +#if defined(_AIX)
>> +#include "java_md_aix.h"
>> +#endif
>> +
>> from java_md_common.c to the end of
>> java.base/unix/native/libjli/java_md.h. It will then be automatically
>> included into java_md_common.c trough java.h which includes java_md.h
>> Also, this version of dladdr is inherently not thread safe. I don't
>> think that's a problem here, but it would be nice if you could quickly
>> check if that's indeed true.
>> Besides that, looks good.
>> Thanks for fixing,
>> Volker
>> On Fri, Sep 16, 2016 at 11:58 AM, Langer, Christoph
>> <christoph.langer at sap.com> wrote:
>>> Hi,
>>> the fix for https://bugs.openjdk.java.net/browse/JDK-8165524 breaks the
>>> AIX build as function dladdr is not available on AIX.
>>> There already exist ports of that API in hotspot and awt. With the
>>> proposed change I duplicate the awt port to libjli. This is maybe only a
>>> quick fix - eventually we should think about consolidating and using the
>>> hotspot port in all places by exporting it from libjvm.so for AIX.
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8166189
>>> Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8166189.0/
>>> Thanks
>>> Christoph
>>> -----Original Message-----
>>>> From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On
>>>> Behalf
>>>> Of Kumar Srinivasan
>>>> Sent: Montag, 12. September 2016 22:57
>>>> To: core-libs-dev <core-libs-dev at openjdk.java.net>; Mandy Chung
>>>> <mandy.chung at oracle.com>; Chris Bensen <chris.bensen at oracle.com>
>>>> Subject: RFR: 8165524: Better detect JRE that Linux JLI will be using
>>>> Hello,
>>>> I am sponsoring this changeset for Chris Bensen of the java packager
>>>> team, please review  fix for the launcher to  better locate java.home.
>>>> http://cr.openjdk.java.net/~ksrini/8165524/
>>>> Thanks
>>>> Kumar

More information about the core-libs-dev mailing list