On Wed, Sep 28, 2016 at 3:03 PM, Kumar Srinivasan <kumar.x.sriniva...@oracle.com> wrote: > > Hello Thomas, Volker, > > > 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. > > > I understand your desire to keep AIX pristine and clean, similarly, > we should also keep OpenJDK sources clean, having 3 identical > dladdr implementation, spread across the OpenJDK does not > bode well. > > So, is it possible to park the sources in hotspot repo, and create a > shared shared object, that can be suitably linked to the launchers, > awt and hotspot to this library/object ?
I don't think this can be easily done with the current build system. Remember for example that even such a sensitive part like jni.h is still duplicated between the hotspot and the jdk repository: hotspot/src/share/vm/prims/jni.h jdk/src/java.base/share/native/include/jni.h So before we envision a solution for the various dladdr implementations for AIX we should really come up with a general way to share code between hotspot and jdk. I've cc'ed build-dev because I think this is to a big part a build/infrastructure issue. If somebody has a good idea, please let me know :) Regards, Volker > > Thanks > Kumar > > > > > Kind Regards, Thomas > >> Thanks >> >> 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.lan...@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-boun...@openjdk.java.net] On >>>>> Behalf >>>>> Of Kumar Srinivasan >>>>> Sent: Montag, 12. September 2016 22:57 >>>>> To: core-libs-dev <core-libs-...@openjdk.java.net>; Mandy Chung >>>>> <mandy.ch...@oracle.com>; Chris Bensen <chris.ben...@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 >> >> > >